Finding Window's java program path in LabVIEW

I'm writing some software that depends on various java files being installed correctly into the lib/ext folders and bin folders of the current version of the java runtime installed.  I'd like to be able to check if these files are in place and give an appropriate error message in my LabVIEW code if they are not.  However, the path to these folders may be different on different machines depending on the the version of java installed and the version of windows used (e.g. C:\Program Files (x86)\Java\jre7   vs.  C:\Program Files\Java\jre6).  I'm using the 32 bit version of LabVIEW and the System Exec.vi to make all my calls to java.  Does anyone know of a way directly from LabVIEW or a command in Windows I could use from System Exec.vi to find these paths?  Thank you.
Solved!
Go to Solution.

GollumGTH wrote:
Yea, this is what I was finding after much googling and playing around...
So I just have to do the windows command java -version, parse the results for the current java version, use that info to generate a query for the reg command and then parse those results... what could possibly go wrong... 
There's functions for accessing the registry in Connectivity -> Windows Registry Access
/Y
LabVIEW 8.2 - 2014
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
G# - Free award winning reference based OOP for LV

Similar Messages

  • How convert to below lab window ansi c program in to labview

    hi
    here how convert  to below lab window ansi c program in to labview program ,please find any body sollution for this problem.
    Attachments:
    Template.c ‏8 KB
    Template.uir ‏13 KB

    Instead of starting with old c code -- which is likely only marginally useful anyways -- you should start with program requirements.
    What does the program do? What are the operational constraints? You know, all the usual stuff.
    Mike
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to reboot windows using java program?

    Hi,
    If I want to reboot the windows by Java Program,How?
    Thank you!

    what about windows server 2003?
    Runtime.getRuntime().exec("shutdown -r
    ");it will work only for windows xp

  • How to find that a java program is running for the first time on daily basi

    it is like this
    1. i will ran a java program every day and i have to find that it is running for the first time(as i may stop that program and may run again the same day )
    Pls share ur ideas

    san.kumar wrote:
    it is like this
    1. i will ran a java program every day and i have to find that it is running for the first time(as i may stop that program and may run again the same day )
    Pls share ur ideasAs kajbj said - you need to store a token / file with a run date on the file system. Each time the application runs, have it compare with the date from this file with the current date. If different, it's the first run of the day. If not, it is not the first run of the day. Each time have it update the date on the file.

  • Fill in login Window by Java Program

    Dear gurus,
    I am taking a security subject and have the assignment to write program to attack a site with brute force. The password is made up of 3 letters.
    My problem is how can I have a java program to try logging in and fill in the user login windows (from Apache).
    I can ensure this is an uni assignment, not a message from an hacker (attacker).
    Advise of all types are appreciated.
    Regards,
    Francis

    Hi,
    you can pass usernam and password in the URL, so you don't have to fill in the login window. E.g.
    http://username:[email protected]
    (this is not an existing URL, do don't click on it).
    Andre

  • How can i find what the java.library.path is?? urgent

    Hi,
    I have an unsatisfiedlinkerror and the message is no jicmp in java.library.path. can anyone tell me how to do System.out.println and the path???
    This is very urgent so anyhelp would be gratefully recieved
    Thanks
    Vanessa

    I have an unsatisfiedlinkerror and the message is no
    jicmp in java.library.path.
    can anyone tell me how to
    do System.out.println and the path???System.getProperty() will retrieve the Java-defined system properties. You can use the following code to determine the available values:
    public static void main( String [] args ) {
    java.util.Properties p = System.getProperties();
    java.util.Enumeration keys = p.keys();
    while( keys.hasMoreElements() ) {
    System.out.println( keys.nextElement() );
    Refer http://www.javaworld.com/javaworld/javaqa/2001-07/01-qa-0706-env.html
    Jatin

  • Getting hold of operating system windows from java program

    I want to make a java desktop application that is aware of other windows on the desktop. Targetted primarily for windows xp/vista.
    It should be able to "find" the current windows on the desktop (running from other applications) and draw a textual message ontop of them.
    Is this at all possible with java? And if so, can someone give me a point in the direction to take. What i would need first is a way to get hold of the windows, basically their size and x,y values somehow from within the java code...

    I want to make a java desktop application that is aware of other windows on the desktop. Targetted primarily for windows xp/vista.
    It should be able to "find" the current windows on the desktop (running from other applications) and draw a textual message ontop of them.
    Is this at all possible with java? And if so, can someone give me a point in the direction to take. What i would need first is a way to get hold of the windows, basically their size and x,y values somehow from within the java code...

  • Problem while running dos command from java program

    Dear friends,
    I need to terminate a running jar file from my java program which is running in the windows os.
    For that i have an dos command to find process id of java program and kill by using tskill command.
    Command to find process id is,
    wmic /output:ProcessList.txt process where "name='java.exe'" get commandline,processid
    This command gives the ProcessList.txt file and it contains the processid. I have to read this file to find the processid.
    when i execute this command in dos prompt, it gives the processid in the ProcessList.txt file. But when i execute the same command in java program it keeps running mode only.
    Code to run this command is,
    public class KillProcess {
         public static void main(String args[]) {
              KillProcess kProcess = new KillProcess();
              kProcess.getRunningProcess();
              kProcess = new KillProcess();
              kProcess.readProcessFile();
         public void getRunningProcess() {
              String cmd = "wmic /output:ProcessList.txt process where \"name='java.exe'\" get commandline,processid";
              try {
                   Runtime run = Runtime.getRuntime();
                   Process process = run.exec(cmd);
                   int i = process.waitFor();
                   String s = null;
                   if(i==0) {
                        BufferedReader stdInput = new BufferedReader(new
                               InputStreamReader(process.getInputStream()));
                        while ((s = stdInput.readLine()) != null) {
                         System.out.println("--> "+s);
                   } else {
                        BufferedReader stdError = new BufferedReader(new
                               InputStreamReader(process.getErrorStream()));
                        while ((s = stdError.readLine()) != null) {
                         System.out.println("====> "+ s);
                   System.out.println("Running process End....");
              } catch(Exception e) {
                   e.printStackTrace();
         public String readProcessFile() {
              System.out.println("Read Process File...");
              File file = null;
              FileInputStream fis = null;
              BufferedReader br = null;
              String pixieLoc = "";
              try {
                   file = new File("ProcessList.txt");
                   if (file.exists() && file.length() > 0) {
                        fis = new FileInputStream(file);
                        br = new BufferedReader(new InputStreamReader(fis, "UTF-16"));
                        String line;
                        while((line = br.readLine()) != null)  {
                             System.out.println(line);
                   } else {
                        System.out.println("No such file");
              } catch (Exception e) {
                   e.printStackTrace();
              return pixieLoc;
    }     when i remove the process.waitFor(), then while reading the ProcessList.txt file, it says "No such file".
    if i give process.waitFor(), then it's in running mode and program is not completed.
    Colud anyone please tell me how to handle this situation?
    or Is there anyother way to kill the one running process in windows from java program?
    Thanks in advance,
    Sathish

    Hi masijade,
    The modified code is,
    class StreamGobbler extends Thread
        InputStream is;
        String type;
        StreamGobbler(InputStream is, String type)
            this.is = is;
            this.type = type;
        public void run()
            try
                InputStreamReader isr = new InputStreamReader(is, "UTF-16");
                BufferedReader br = new BufferedReader(isr);
                String line=null;
                while ( (line = br.readLine()) != null)
                    System.out.println(type + ">" + line);
                } catch (IOException ioe)
                    ioe.printStackTrace(); 
    public class GoodWindowsExec
        public static void main(String args[])
            try
                String osName = System.getProperty("os.name" );
                String[] cmd = new String[3];
                 if( osName.equals( "Windows 95" ) )
                    cmd[0] = "command.com" ;
                    cmd[1] = "/C" ;
                    cmd[2] = "wmic process where \"name='java.exe'\" get commandline,processid";
                } else {
                    cmd[0] = "cmd.exe" ;
                    cmd[1] = "/C" ;
                    cmd[2] = "wmic process where \"name='java.exe'\" get commandline,processid";
                Runtime rt = Runtime.getRuntime();
                System.out.println("Execing " + cmd[0] + " " + cmd[1]
                                   + " " + cmd[2]);
                Process proc = rt.exec(cmd);
                System.out.println("Executing.......");
                // any error message?
                StreamGobbler errorGobbler = new
                    StreamGobbler(proc.getErrorStream(), "ERROR");           
                          // any output?
              StreamGobbler outputGobbler = new
                    StreamGobbler(proc.getInputStream(), "OUTPUT");
                          // kick them off
                errorGobbler.start();
                outputGobbler.start();
                // any error???
                int exitVal = proc.waitFor();
                System.out.println("ExitValue: " + exitVal);       
            } catch (Throwable t)
                t.printStackTrace();
    }when i execute the above code, i got output as,
    Execing cmd.exe /C wmic process where "name='java.exe'" get commandline,processid
    and keeps in running mode only.
    If i execute the same command in dos prompt,
    CommandLine
    ProcessId
    java -classpath ./../lib/StartApp.jar;./../lib; com.abc.middle.startapp.StartAPP  2468
    If i modify the command as,
    cmd.exe /C wmic process where "name='java.exe'" get commandline,processid  > 123.txt
    and keeps in running mode only.
    If i open the file when program in running mode, no contents in that file.
    If i terminte the program and if i open the file, then i find the processid in that file.
    Can you help me to solve this issue?

  • How to access a file in Unix server from windows using java

    I want to access a file in unix server from windows using java program.
    I have the following code. I am able to open the url in a web browser.
    String urlStr="ftp:user:passwd@unix-server:ftp-port//javatest/test.csv;type=i";
    URL url = new URL(urlStr);
    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream)));
    String inputLine;
    while((inputLine=in.readLine()))!=null){
    System.out.println(inputLine);
    in.close();
    I get the following error
    java.io.FileNotFoundException: /javatest/test.csv
    at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:333)
    at java.net.URL.openStream(URL.java:960)
    at com.test.samples.Test.main(Test.java:45)

    urlStr="ftp:user:passwd@unix-server:ftp-port//javatest/test.csv;type=i";
    I have given the format of the urlStr that I am using in the code. The actiual values are used in my code. I have tried pasting this url in the browser and it opens the file.

  • Slow finder window display

    Everytime I open a finder window. It takes about 2-5 seconds before the contents of the finder window are displayed. How can I fix this? I don't have this problem on my G4 PPC mirror desktop running 10.5.2 as well. This has been happening on my 24" iMac ever since I have moved from Tiger to Leopard last fall.
    When I go into Path finder, finder windows open instantaneously under Path Finder.
    Please let me know what I should do to solve this problem so that when I open any finder window it opens quickly and furthermore displays the contents of the folder quicker.

    I posted about this way back when 10.5 came out. I did the new account thing, it doesn't work. What worked for me was. You have to set the mouse double click speed to the highest setting. When set to high the windows pop right open. Try it and post back. I sent the info to Apple about it.

  • Launch ODBC data source window in Java

    Hi , In windows OS , when config the database data source ,I have to launch the ODBC data source administrator window in the control panel , I think this is a troubled thing .Can I call the window in java program directly ? Thanks.
    Liwei

    I read this recently on this Forum. So, yes .. apparently it can be done.
    <------ Search 'DB' etc - by date and look for something 2 days back. Also if you check the New To.. forum I posted a jdbc.odbc program about 5 days back to test your driver. Good luck (actually this is a bit tricky the first time, so keep at it)

  • How to find cd rom drive in windows and unix platform using java program

    Hi,
    I am having the requirement of finding the cd rom drive
    using java program. I do not know the label and which
    one is the cd rom drive. also I want to know how many
    cd rom drives are there on my system. I want the solution
    for windows and unix platforms.
    If have any suggestions please mail to [email protected]
    Deepak

    Ughhh.. I had the same problem with multi platform file-system detection
    First off - Unix.
    Do you know for sure you have all your drives mounted?? This could be a big problem because java will not see unmounted drives... So you can scour thru your /etc/fstab to find out which drives are available... or you can mount all and show roots... (Yuck!)... You've got timeouts and all sorts of things to worry about...
    I would then shy away from the java.io.File.listRoots() on unix and rely on parsing your fs file. If a user would like to see the medium in the drive. Do a Runtime.exec and mount the drive, then you can grab the filesystem by wrapping it in the java.io.File object. ( NOTE - this will hold well for your NFS mounts as well which might be buried under other FS. So you now have detection for that as well. ) Labels are also noted in this file. Let me know if you don't know the difference between mtab and fstab....
    Second - Winders.... Corney but I love saying that.
    The listRoots is a good solution. As others have said CD-ROMS will not be writable. Use a combination of getName and getPath to decipher the label and mount point.
    Hope this helps!

  • Starting a java program on a ordinary windows computer (without JDK)

    I have made an ordinary java program which reads from a specified text file, changes it a bit and then creates a new file with the new text. This works good when I use a computer with an JDK installed, but I must be able to run this program on a Windows 2000 computer (without any "extras" installed, only the programs that are included in Windows 2000). The reason for this is that I'm not allowed to install programs on this computer. Can anyone help me?

    You neither need to
    1- have a JRE installed on the computer (Java Runtime Environment)
    The Java Virtual Machine to convert the compiled byte code into the necessary instructions for the computer it is running on... W/O it...can't run it.
    2- create a native executable...there are packages etc for which this is true. If you can install NOTHING on the computer... you would either
    A- Find one of the packages that creates .exe files from java or class files
    B- Bundle the JRE with it... it doesn't need to be 'installed' persay-- unpack the directories and create a batch file that calls <path-to-java>/java <path-to-program>myclass
    C- Write it in C or C++
    That is not an inclusive list of possibilities... Java's portability comes with the price-tag of needing something that can run it... once you have that something (and the JRE is fairly ubiquitous, or at least, easy to get if not present generally) ... you can run the program.
    ~Dave

  • Windows classpath vs java.class.path error in QuickTime based applet

    Hello
    I've spent days reading and searching the internet, and I'm still stumped why some Windows installations are not able to run my QuickTime for Java based applet even though QuickTime is installed (the specific error is: java.lang.NoClassDefFoundError: quicktime/QTException). I have some additional details and a question that might spur someone to an insightful nudge.
    On a Windows system that fails:
    echo %classpath%
    .;C:\Program Files\QuickTime\QTSystem\QTJava.zipWhich is where QTJava.zip is found on the (faulty?) system, but java.class.path is just:
    java.class.path = C:\PROGRA~1\Java\jre6\classes
    Of the dumped system properties, only java.library.path makes any mention of the QTSystem folder (or any other QT or QuickTime related items).
    java.library.path = C:\Program Files\Safari;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\PROGRA~1\Java\jre6\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\QuickTime\QTSystem\
    I ran across one thread (elsewhere) where the user was having problems with loading some classes from a complex JAR environment, and a solution was to write a custom class loader. After doing so, the user got the same error "java.lang.NoClassDefFoundError: quicktime/QTException" that was resolved by extending the custom class loader to include .zip files. I'm not sure if the solution is relevant, or if he simply broke something in his custom class loader that would have worked otherwise. I've not written a custom class loader and not sure where to begin, so before I ventured down that path I was hoping someone might shed some light as to if this is a dead end or potential solution. This is a signed applet (QuickTime now requires it, even if you are only playing files of the same server) and it does work on several Windows machines and all tested Macs.
    Thank you,
    Deron
    output to Java Console with level 5 tracing enabled
    basic: Joining applet thread ...
    basic: Joined applet thread ...
    basic: Referencing classloader: sun.plugin.ClassLoaderInfo@750159, refcount=2
    basic: Finding information ...
    basic: Releasing classloader: sun.plugin.ClassLoaderInfo@750159, refcount=1
    basic: Done ...
    basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@3a9bba
    basic: Loading applet ...
    basic: Initializing applet ...
    basic: Starting applet ...
    basic: completed perf rollup
    network: Cache entry not found [url: http://www.equushd.com/quicktime/QTException.class, version: null]
    network: Connecting http://www.equushd.com/quicktime/QTException.class with proxy=DIRECT
    network: Connecting socket://www.equushd.com:80 with proxy=DIRECT
    java.lang.NoClassDefFoundError: quicktime/QTException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: quicktime.QTException
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 10 more
    basic: Exception: java.lang.NoClassDefFoundError: quicktime/QTException
    Ignored exception: java.lang.NoClassDefFoundError: quicktime/QTException

    Something is wrong with the library.
    Staring at java code will not help you figure that out.
    Maybe it isn't intended to be loaded in java but instead it loads java itself?
    If not then write a C/C++ basic app that links that dll in and see if you can at least get it to start.

  • Oracle 11gR1 on Windows Xp Error Cannot find J2SE SDK installed at path

    When I type in path for java.exe in SQL Dev. , I get error 'Cannot find J2SE SDK installed at path: C:\Program Files\Java\jre6.' when I entered the path C:\Program Files\Java\jre6\bin\java. What is the reason for this error? How can I correct it? Database installation said it was successful

    SQL Developer needs the Java JDK not the JRE to operate successfully. Your path looks like a path to the JRE. There is a windows download that comes complete with a Java Developer kit.
    regards
    Niall

Maybe you are looking for

  • A better way to syncronize objects in servlets

    Hi, I am working on a webapp that has a servlet that invoque a instance of a object that accesses our sybase server. What is the best secure way to syncronize to avoid problems at the database? I have searched all of these but I am still confused: Sy

  • InDesign to PDF, ok Adobe Reader, bad in Apple Preview

    Hello I have an InDesign file that has been saved as an interactive pdf.  There are several .psd files in the document.  (selected objects with the surrounding area made transparent).  I have been opening the file in Adobe Reader (on a PC), and didn'

  • My CD will not eject?

    Downloading CD and now it won't eject, can anyone send suggestions? Keyboard commands arent working. thx.

  • Strange NUMC, Can anyone please Define NUMC.

    Hi Experts, I have experienced a Strange things with NUMC. How ever you define your Numc (straight or dictionary ref like "DATA: value1 TYPE pa0000-pernr) or what ever. I have seen different results different scenarios as shown in below example. REPO

  • Pasting cells into tables - what has changed?

    Sometime this year something has changed with the ability to copy and paste multiple cells from a table in a Word.doc into a table in InDesign CC. I used to be able to select the same number of cells, copy and paste directly then proceed with formatt