GeeCON Prague 2014*
The moose likes Java in General and the fly likes Porting application to a Mac (from Win98) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "Porting application to a Mac (from Win98)" Watch "Porting application to a Mac (from Win98)" New topic

Porting application to a Mac (from Win98)

Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
I'm trying to port a Win98 project I'm working on to a Mac and I know nothing about Macs.
The application uses a jar files to hold large colllection of HTML pages with internal links. These pages were downloaded from a web site. The java code also in the jar, starts a server on a port(8090) and launches the default browser with first address of: I have this working fine on Win98. I found code for launching a browser on the Mac and need the following package: import; and then how to debug it? I use System.out.println() on Win98 for debug output, where would the output from the println() go on a Mac?
In current testing on a Mac the server started ok, opened its window, but the browser wasn't started. The user started his browser and manually entered the above address and the server delivered the starting page. Links with the pages mostly worked but there was some problems getting some of the gifs which I'm not sure about yet. The Search routine fails immediately.
The search feature that is called from the HTML via a <form using POST. The search routine then loads all the files from the jar file into a pseudo file hierarchy and and uses a search class I'd written long ago to search thru folders. I created a InJarFile extension of the File class and made about 4 lines of changes to my search program to allow it to search the files in the jar as well as in the Win98 file system.
On Win98 I use: URL ourLoc = obj.getClass().getResource(className); to get the path to the jar file and then use ZipFile and ZipEntries to get the contents of the jar file so it can be searched.
How do I read the contents of a jar file on a Mac? From a class loaded from that jar file.
I guess I need to understand paths on a Mac??

The URL returned from: URL ourLoc = obj.getClass().getResource(className); for a file in a jar file on Win98 is:


This can be parsed to extract the path to the jar file: D:/JavaDevelopment/NormsTools/Testing/FindOurHome.jar
What is returned by getResource() on a Mac system?

Is there any other way to get the parameter for the ZipFile() constructor on a Mac that will access the jar file that the class is in? And that also works on Windows!

PS This is also posted on the Sun Java programming site, with no progress yet.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42061
Norm, a few random ideas:

- The was part of JDK 1.3 on OS X (and JDK 1.1 on OS 9 before),
but was dropped in JDK 1.4, because there are newer helper classes, namely Either try to use the newer version, and get ahold of 1.3 somehow.

- Launching browsers in a cross-platform way can be done using the BrowserLauncher from SourceForge

- I don't think opening jars is different on the Mac than on Windows. Of course, the Mac
is a Unix machine, so try something like jar:file:/Users/norm/...... (haven't tried it myself)

Hope this helps.

Ping & DNS - my free Android networking tools app
Consider Paul's rocket mass heater.
subject: Porting application to a Mac (from Win98)