Solved

Can you change classpath while the vm is executing?

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

Technology Partners: 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

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 …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

705 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