1

Is there a workaround or a solution to having to place the javax.comm.properties file and the win32com.dll file in their respective folders?

My program works fine when I have the files stored as below:
%JAVA_HOME%/jre/lib/ext/comm.jar
%JAVA_HOME%/bin/win32com.dll
%JAVA_HOME%/lib/javax.comm.properties

This worked well until IT changed the permissions on our computers so that we can no longer write to these folders. I'd like to be able to install the Java program I wrote that uses the serial port once without needing to re-install it every time IT decides to update our JVMs. Does anyone know of a way to do this?

mjh2007
  • 776
  • 1
  • 8
  • 17

1 Answers1

0

It's always a good practice to decouple the execution of your application from the configuration of the machine it is running on. In your case the first task will be identifying where you want to store the extra libraries and configuration files that are needed (its probably best to bundle them with your application). Once that is done, then you can configure your application to find them at launch:

Assuming the following directory tree:

myapp
  |
  --lib (archives and shared libraries stored here)
  |
  --resources (configuration files go here)

You could do:

java -Xbootclasspath/a:myapp/lib/comm.jar -cp "myapp/lib/*:myapp/resources" -Djava.library.path="myapp/lib"

Your JAR and DLL files would go into the lib sub-folder, and the property file would go into the resources subfolder.

Perception
  • 79,279
  • 19
  • 185
  • 195