Solved

Can you change classpath while the vm is executing?

Posted on 1997-05-12
2
353 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

733 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