Java classpath with Environment variable..

Hi,
I need to start an Java application with an Environment variable(EV) as class path.
Ex:
I have an EV APP_PATH =c:\myapp
so i will give java -cp c:\myapp, instead of doing like this I need to give APP_PATH in the java -cp<EV>.
I gave like this java -cp %APP_PATH% and that doesn't work...
Is this the correct way or how to do this ?
Thanks.

I gave like this java -cp %APP_PATH% and that doesn't
work...It does if APP_PATH has the correct value.
Try echo %APP_PATH% and see if it's what you expect. They plug whatever that returns into your java command.
Is this the correct way or how to do this ?That's the correct way. You APP_PATH must be wrong.

Similar Messages

  • Overwrite java parameters with environment variables or other mechanism???

    I am using several java programs on my machine. Each of them uses some deeply nested startup script so I have no chance to modify the parameters of the java command.
    I would need to change certain parameters though, e.g. the heap size or certain system properties.
    Is there a way to do this by e.g. setting environment variables or modifying a user-specific configuration file?
    I am using jdk 1.5.0_06 on Linux (Ubuntu).

    Well the ones I am dealing with do not, unfortunately.
    I am also interested in a general way to tune the JVM settings without modifying each and every call statement.
    Surely there must be some mechanism to achieve this??

  • Problem with environment variables

    JAVA_HOME = C:\JBuilder9\jdk1.4
    Path = C:\oracle\product\10.1.0\Db_1\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin\client;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;.;C:\oracle1\product\10.1.0\Db_3\jdbc\lib\classes12.zip
    When I run foo.java I get this error, which i believe is because of some kind
    of problem with environment variables.
    Exception in thread "main" java.lang.NoClassDefFoundError: OraThinI eliminated this path
    C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin
    just to check whether two paths of jdk bin folder is causing problem but I see no change.
    Please help

    I had solved it myself
    I am a genious :P
    Just do this
    JAVA_HOME = C:\JBuilder9\jdk1.4
    CLASSPATH = C:\oracle\product\10.1.0\Db_1\jdbc\lib\classes12.zip;.;%JAVA_HOME%\bin
    PATH= C:\oracle\product\10.1.0\Db_1\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin;C:\oracle\product\10.1.0\Db_1\jre\1.4.2\bin\client;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;.;C:\oracle1\product\10.1.0\Db_3\jdbc\lib\classes12.zip;%JAVA_HOME%\bin

  • Help reqd on Trace with environment variables

    Hi,
    Please let me know the procedure to set trace with environment variables.
    Kindly forward any related links to this.
    regards,
    Naveen.A

    Hi Naveen,
              Go through this help documents. Hope it helps.
    http://help.sap.com/saphelp_nw04/helpdata/en/5e/4dfca06fc1ea4ea31c0c522c62cb1a/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ef/8eb899cf32416eaa452329c64acb5f/frameset.htm
    Cheers,
    Aravindhan

  • Problem with environment variable & compiling

    G'day all,
    I'm totally confused :(
    I've set my environment detail but when I use javac the command window just does nothing. The cursor (or flashing thingo) drops to the line below and just hangs there. If i manually type in the entire path javac works fine.
    Image of my environment variable window is here:
    http://img130.imageshack.us/img130/5120/environvariables.jpg
    Using Windows 7, JDK 1.6.0_18 and latest version of Eclipse is installed.
    Second issue:
    I wrote a program using Eclipse. It all went into a package named "openagil". 3 classes in total. Class "A", "B", "C". A uses both B and C. It creates an instance of B and C. Included in each is package openagil; at the very top.
    Running in eclipse it works fine. However, how do I compile this using javac and then in turn run it? The .java files are located within a workbench folder (java) and then in the package directory (openagil). These are contained on the D drive so "d:\java\openagil" - No class variables are set as I am unsure how this is done (despite reading a few guides).
    I can do javac d:\...*.java and it'll compile all of them fine but I am then unsure how to run it. I think what I do is do java openagil.classA but this pulls up errors - an "exception in thread' error followed by a "noclassdeffound: openagil/classA" then a whole bunch of URL/Access Controller stuff.
    I understand programming fine, but configuring this is a bitch. My Java book doesn't cover installation nor does it cover packages and the

    LordMidol wrote:
    Second issue:
    I wrote a program using Eclipse. It all went into a package named "openagil". 3 classes in total. Class "A", "B", "C". A uses both B and C. It creates an instance of B and C. Included in each is package openagil; at the very top.
    Running in eclipse it works fine. However, how do I compile this using javac and then in turn run it? The .java files are located within a workbench folder (java) and then in the package directory (openagil). These are contained on the D drive so "d:\java\openagil" - No class variables are set as I am unsure how this is done (despite reading a few guides).
    I can do javac d:\...*.java and it'll compile all of them fine but I am then unsure how to run it. I think what I do is do java openagil.classA but this pulls up errors - an "exception in thread' error followed by a "noclassdeffound: openagil/classA" then a whole bunch of URL/Access Controller stuff.You need to us the -classpath (or -cp) command line option to specify where java looks for your .class files. I think it would be java -cp d:\java openagil.classAFYI class naming convention is to start with a capital letter - YourMainClass for example. It may help to go here [http://java.sun.com/javase/6/docs/technotes/tools/index.html] and go to General Information, then click on How Classes Are Found.

  • Problem with environment variable settings

    I am using J2SDK1.4.1
    I have set the classpath variables and path variables properly.
    When I go to commandline c:\> and type the command "javac" I get a message as follows---
    Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
    has value '1.4', but '1.3' is required.
    Error: could not find java.dll
    Error: could not find Java 2 Runtime Environment.
    If I change directory to c:\j2sdk1.4.1\bin> and type javac c:\dir_name\filename.java then the file compiles but when I try to run the java file I get an error message "Exception in thread main no ClassDef Found".
    How do I compile and run my java files.
    Can any body help me out.

    Your registry has some information in it that is in conflict with the 1.4.1 installation. Search the forums, there are some strings that address this problem of version conflicts.

  • Problem with ENVIRONMENT VARIABLES in MS-DOS

    I have just installed JDK & J2EESDK under the directory C:\Program Files.
    I set my JAVA_HOME to C:\Program Files\jdkblahblah\bin
    and J2EE_HOME to C:\Program Files\j2eesdkblahblah\bin
    and CLASSPATH to %J2EE_HOME%\lib\j2ee.jar
    As you may have noticed there is a space in the directory "Program Files" and this has been giving me a lotta problems. When i try to run any batch files it doesn't recognise the classpath...Same thing happens when i try to run javac with the -classpath option.
    Even when i use full path names instead of env.variables it still has problems as it is assuming the latter part after the space(Files\j2ee..) and the one before the space(C:\Program) as two different paths....
    How do i fix this? I have a work-around but, I would like to know how to fix this thing...

    I guess that surrounding the path with quotes might help. You have windoze on your 'puter, haven't you. In case of Win2K, right click on "my computer", select "properties", select "special", and then "environment variables". There you may edit the PATH. I guess editing the classpath is also a must.
    Or, alternatively, uninstall java, and reinstall it in the root directory, without having white spaces in the path. Makes your life much easier...

  • Classpath in Environment Variables

    Dear All,
    After I put " ; " in front of Environment Variables in Win XP System Properties
    so my classpath=;C:\tomcat4\common\lib\servlet.jar;C:\tomcat4\webapps\aplikasiku\WEB-INF\lib\mssqlserver.jar;C:\tomcat4\webapps\aplikasiku\WEB-INF\lib\msbase.jar;C:\tomcat4\webapps\aplikasiku\WEB-INF\lib\msutil.jar. then my problem solved. I never found NoClassDefFoundError in my java.
    Is it ok to use that classpath?
    Thanks

    Hi,
    It can be used but should really really be avoided since it makes it makes it very hard to use when you have multiple applications, and applications of different versions.
    Kaj

  • Java and UNIX environment variables

    Hi folks,
    am I right when I say that it is not possible to access UNIX environment variables from Java (these ones delared by the export statement)?
    Cheers,
    Heiko

    Yes.. Since some OS do not have the  concept of environment variables,it is directly not possible.
    But using the method System.getProperties you can get
    some inf about the environment.
    the following links may be of some help to you
    http://www.javaworld.com/javaworld/javaqa/2001-07/01-qa-0706-env.html
    http://www.jguru.com/faq/view.jsp?EID=11422

  • Unable to start java tools - Error : Environment variable JAVA_HOME not set

    hi all,
    I am not able to start the java tool - Visual Admin, Configtool, etc in the solaris Bash shell.
    I was given authorizations on solaris and i'm able to view the logs and browse in solaris boxes,
    But, when i try to start Visual Admin, it says" ERROR environment variable JAVA_HOME not set "
    Since,my colleagues are using this tool for years, how come the environment variable is not set only for my user profile ?
    Is it like the environment variable has to set seperately for every user profile ?
    Do i need to set it initially for my profile eventhough it is working for others ?
    i am confused..please help.
    Addy

    Nicholls, Thanks for your quick reply.
    Ofcourse, I use my login ID to use java tools and they use their's obviously.I don't use <SID>adm.
    We WRQ reflection for X-Windows and Putty for Command line Solaris Access.
    When i try to use VA through the X-Window tool WRQ reflection, I am not able to start the tool.
    My doubt here is, Do we need to setup the environment variable for every new user initially for the first time ? ( I am a new user for this environment )
    Supposing if i need to setup the environment variable, do i need to set it up for the all the Solaris Boxes i use ?
    I am able to browse through the files.when i try to start the VA by giving ./go i am not able to start it up.
    Appreciate your time and valuable replies.
    Addy

  • Does "Allow log on locally" work with environment variables?

    This is merely out of curiosity and just because I'm doing some conceptual gambling.
    I'd like to create a GPO having the Allow log on locally set to something like the following list:
    %OWNER%
    BUILTIN\Administrators
    The concept behind this is to prepare the system during OS installation with a value to the OWNER environment variable to allow only the specified user account (apart from the Administrators group, of course) to log on to the system without A) having to
    configure this setting locally on the client and B) having a great range of different GPOs to handle all the user/computer combinations.
    My questions are:
    Does this work at all?
    If it works, what do I need to provide as a value?
    I've already tried to set <user name>, <domain name>\<user name> and
    <user name>@<FQDN> but none of those seem to work.

    Hi,
    Glad to see your problem resolved. Hope your experience could helps other who had same cofusion.
    Roger Lu
    TechNet Community Support

  • Create a Java Object with Dynamic Variables

    Hi ,
    I am constructing a web based system which stores personal information on people. I have created a Person class with all the obvoius variables, forename, surname, address etc.. My problem is that some clients wish to make use of some of the variables, some want other variables and as i meet others they wish to add in some new variables eg
    Client 1 wishes to store; Forename, Surname and Address
    Client 2 wishes to store Forename, AltForename, Surname, AltSurname and Address ( AltForename - this is an alternative Forename in this case the Irish translation of their English name)
    Client 3 wishes to store Forename, Surname, Title, Address, Height, Weight, DOB, School, Occcupation.
    Each of the clients above need to submit these in an online form with each form looking different due to the fields they have to enter and also with different validation rules.
    At present i have a Person object handling all fields i can think of and different validation methods depending on the client, but there must be a better way of doing this as each time a new field is added by a new or existing client, i not only have to update the java and jsp but also the DB.
    This is all web based and i wish to use the same code base and data source for all clients. I also wish it to be all web based. So in theory if a client asked to add in a "middle name" field to their form and make it mandatory, i could go to an admin page which lists all the possible input element types and select the "field type" then set validation rules on it.
    All the web based and DB parts can be ignored - the main issue here is creating a Person class which can have any number of variables of varying types ( String, Int, etc)
    Regards,
    Cormac
    Edited by: cormacodonnell on Jun 27, 2008 6:33 AM

    cormacodonnell wrote:
    Hi ,
    I am constructing a web based system which stores personal information on people. I have created a Person class with all the obvoius variables, forename, surname, address etc.. My problem is that some clients wish to make use of some of the variables, some want other variables and as i meet others they wish to add in some new variables eg
    Client 1 wishes to store; Forename, Surname and Address
    Client 2 wishes to store Forename, AltForename, Surname, AltSurname and Address ( AltForename - this is an alternative Forename in this case the Irish translation of their English name)
    Client 3 wishes to store Forename, Surname, Title, Address, Height, Weight, DOB, School, Occcupation.You could extend the Person class with 3 sub classes, but that might be overkill just to store personal info.
    Each of the clients above need to submit these in an online form with each form looking different due to the fields they have to enter and also with different validation rules.
    At present i have a Person object handling all fields i can think of and different validation methods depending on the client, That's probably how I'd do it if it's not too much trouble. But to be OO you should probably go the inheritence route.
    but there must be a better way of doing this as each time a new field is added by a new or existing client, i not only have to update the java and jsp but also the DB. Welcome to software development. It's called "feature creep" or "scope creep". As soon as you get your code working right and deploy it and get ready to go on vacation, the customer always comes back with something else they "need" or "forgot". The app I'm building right now I've rewritten or changed 7 times in 3 months because nobody has a clue what they really need.

  • Passing Apache (or OHS) environment variables to WebLogic

    Hi,
    AJP is the protocol used to proxy a Tomcat or Jetty container with Apache HTTP server. Apache environment variables can be passed along to the Java container, instead of using rather insecure HTTP headers.
    Is there a way to do the same thing using Apache and mod_weblogic, or using OHS and mod_wl_ohs? From what I've read, these modules are rather pure HTTP proxies. See for instance this post [1].
    The idea behind this is to integrate a Shibboleth Service Provider (mod_shib on Apache) with WebLogic, using an Identity Assertion Provider in WebLogic to establish user identities. Shibboleth advises NOT to use headers, and use environment variables instead (see [2]), but it seems that the configuration of perimetric authentication for WebLogic should rely on headers to extract username and other info (see [3] and [4]).
    Thanks a lot,
    /ben
    [1] https://groups.google.com/group/shibboleth-users/browse_thread/thread/af5e7caf7c9bbc0b/7933e991cfcbe089?pli=1
    [2] https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSpoofChecking
    [3] http://docs.oracle.com/cd/E21764_01/web.1111/e14395/apache.htm#CDEBCGBI
    [4] http://docs.oracle.com/cd/E21764_01/web.1111/e13718/ia.htm#DEVSP248 ==> Passing Tokens for Perimeter Authentication

    Hi, thanks for the answer.
    However, this is not what I meant with "environment variables". I'm not referring to system environment variables, but to session environment variables of the Apache HTTP server, that it can pass along with requests to a Java container. This mechanism is possible with a Tomcat or Jetty container placed behind a Apache front-end, thx to AJP.
    I'm wondering how to do this with Weblogic, which does not support AJP.
    /ben

  • RCP, Environment Variables, OS X, Info.plist and LSEnvironment

    I've got a somewhat challenging problem here.
    I've got an RCP application that relies upon some shared dynamic libraries which might not be in standard locations (as this is OS X and they are user installed).
    One of the things we need to configure is DYLD_LIBRARY_PATH in order for the shared libraries be discovered. The problem here is OS X doesn't have a simple way to set environment variables that applications launched from the Finder can "see".
    One of the thing that I've found, but not had any success with, is to dynamically modify the RCP's Info.plist to have an additional key LSEnvironment whose value is a dictionary to set environment variables only visible to that application - okay this seems ideal for me. But it's not working.
    I also found that I could use launchctl setenv to set a user global Environment variable, however it's not persistent across launches, and each time I set, I must restart the app. I really need this persistent.
    Does anyone have any solution for setting Environment variables that are visible from the RCP app (and it's children) that works in OS X without having to launch the RCP app from a terminal?
    Thanks in advance!

    Brian de Alwis wrote on Wed, 05 August 2015 19:54Sounds like you want to use System.loadLibrary() with absolute paths?
    That doesn't quite work, as we aren't using JNI. Unfortunately the use-case details get pretty complicated - so I omitted in an effort to make it simpler to understand the problem.
    Basically we have built an IDE that uses the Prolog interpreter, XSB. XSB natively connects to MySQL using the shared MySQL libs. Unfortunately on OS X, MySQL can get installed into possibly one of many locations, and it certainly doesn't install it's libs in /usr/local/lib or /usr/lib. We access XSB via a Java library called Interprolog, which I believe, is just a pipe interface to the command line shell - hence when the Interprolog engine object is instantiated, it fires up a shell process for XSB - which needs to locate those MySQL libraries. Hence, DYLD_LIBRARY_PATH needs to be set to have the path for /usr/local/mysql/lib (or wherever the user installed it) defined in the parent process in order for Interprolog's sub-process to pick up the environment variable.
    Right now there are only 2 reliables ways I have found to get this to work.
    1. Launch Terminal, export the environment variable. Then launch our RCP app from the Terminal. - cumbersome and unintuitive; bad user experience.
    2. Launch Terminal, use `launchctl setenv DYLD_LIBRARY_PATH /usr/local/mysql/lib`. And then one can lacuna our RCP app using Finder. - problem is that DYLD_LIBRARY_PATH is now global to the environment and will not persist between reboots.
    I've tried added the LSEnvironment dictionary to the Info.plist within the RCP application, but that just doesn't seem to work - and I'm not sure if that is because the OS X eclipse launcher doesn't propagate the environment forward or what. For the time being I have a way for the user to click a button which runs launchctl setenv and then prompts the user to exit the app, and then launch again from finder [IWorkbench.restart() doesn't work because new process is a child of the current] - which works but is undesirable workflow as it doesn't persist across a login/reboot.
    My next step is to try what is outlined here: http://stackoverflow.com/questions/829749/launch-mac-eclipse-with-environment-variables-set
    However it feels even more sketchy than just modifying the Info.plist to contain the right environment variables.

  • How i can set environment variable with java?

    i'm tring to set it using System.setProperty("java.class.path") but it dosen't work any body help?

    you will have to find out the EXACT verbage, but it's
    something like this I suppose:
    Runtime runtime = System.getRuntime();
    runtime.exec("cmd set MY_VAR=blahhhhhhh");Yes... this creates a new process, then sets the MY_VAR environment variable for that process to "blahhhhhhh", then terminates that process.
    However I think you are asking the wrong question, since your post suggests you are trying to change your classpath programatically. Ask the question you thought that was the answer to instead.

Maybe you are looking for

  • Priority for Automatic Proccesses in Oracle BPM 10.3

    Hi, I'm completely new to the BPM space, and I was just transferred to a team that's using Oracle BPM 10.3, so my apologies if this is a trivial question. Does anyone know how to implement priority for automatic activities in Oracle BPM 10.3? Basical

  • Calendar syncs only one way

    Just got into iCloud. Calendar from iMac went into the cloud calendar without problem. Adding new event from iMac or MBA goes t the cloud canendar without problem. However, the entry from MBA doesn't show in the iMac canedar nor does the iMac entry s

  • Multiple On Values for Checkbox

    Hi, Is there a way to have multiple On Values for a checkbox. Also, is it possible to do this without using scripts. The forms I'm creating are used within a software application. This application dumps the data into the forms filling them as appropr

  • Scroll Down / Up Report.

    I am creating one dashboard with four Answers (two rows and two columns). Each report is displaying 10 rows per page. But when ever user click on "Next All Pages" button report is displaying all rows. Then following reports are going down. Users are

  • Puchased mountain lion from app store and tried downloading via store 4 times, always rcvg an alert stating "error downloading"

    puchased mountain lion from app store and tried downloading via store 4 times, always rcvg an alert stating "error downloading" Is there any other mean to get the mountain lion. I ve a 512kbps connection.