Solved

Can you change classpath while the vm is executing?

Posted on 1997-05-12
2
351 Views
Last Modified: 2013-11-23
Hi,

I have C app which uses JNI to bring up a vm to execute some methods.
Before, I brought up the vm, I set the class path in the VM's
initialization arguments and that works fine. But, the vm won't find the
class if you specify a class which is not in the class path. Is there
any way, you can change the class path while the vm is up in memory?

I tried a few ways. But, none seem to work. I first tried by resetting
the VM's init_args. This won't work unless you bring up another VM.
Another thing I tried was by calling putenv("classpath=exst classpath +
new cls path"). I thought this should work. But, it didn't. Does anyone
have comments on this or is there other ways of doing it?

Thanks,
Jamie
0
Comment
Question by:jamwang
2 Comments
 
LVL 6

Expert Comment

by:jpk041897
ID: 1220386
getEnv and putEnv were removed from the VM in jdk 1.01 (the calls are still there, they just don't do anything) and completley removed in 1.1. Apperantly for security reasons, (much to the anoiance of Java CGI writters).

The purpose of this removal was to stop users from doing preciseley what you are attempting, this beeing a posible breach of security.

There is no way that will work for applets. For standalone apps, you could exec() a bat/shell script. that modifies the CLASSPATH variable and the launches the new app in a new shell.

The only marginaly acceptable solution I can think of would be to use packages.
0
 
LVL 2

Accepted Solution

by:
majkl earned 100 total points
ID: 1220387
As jpk alreadfy mentioned. You cannot change CLASSPATH from the applet or application.

0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java jdbc batch example 8 34
Facing this issue for maven proxy setting 2 12
jsp insert to database example 2 24
printf performancy 11 41
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question