Hi, 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: http://127.0.0.1:8090. I have this working fine on Win98. I found code for launching a browser on the Mac and need the following package: import com.apple.mrj.MRJFileUtils; 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:
- The com.apple.mrj 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 com.apple.eio.FileManager. 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 - updated with new look and Ping home screen widget