Solved

Can you change classpath while the vm is executing?

Posted on 1997-05-12
2
348 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
copyEndy  challenge 15 55
array220 challenge 8 47
computer science syllabus 3 52
wordcount challenge 11 76
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now