Re: setting path

Grettings, I have a simple question.
I have several java programs that I have written and that work successfully. My problem is that I am running these codes on numerous files located in several places. I would like to set the execution path rather than copying the files (code) to oodles of locations and then executing them from there. Perhaps I am not using the correct terminology, for most of my searches have led me towards j2sdk1.4.1 and classpaths. As always, any constructive critisms are warmly appreciated.

Fair question. I have several java files that I am using. I will list the simpliest one below.
// simple program for creating empty text files
import java.io.*;
import javax.swing.*;
public class addText
     public static void main(String args[]) throws Exception
          String fNumber;
          int numOfFiles;
          fNumber = JOptionPane.showInputDialog("Enter number of files");
          numOfFiles = Integer.parseInt(fNumber);
          String file;
          int fileName;
          file = JOptionPane.showInputDialog("Enter name/number of first file");
          fileName = Integer.parseInt(file);
          for (int iterator = fileName; iterator <= numOfFiles + fileName - 1; iterator++)
               Integer.toString(iterator); //converts integer to a string
               File f  = new File(iterator + ".txt"); //using the string "integer" to name a file
               f.createNewFile();      // creates the file
}So, I have several directories containing subdirectories. I need to execute the above program in files located in all the the dir/subdirectories. Up to this point I have been coping the above code to each folder in the dir/subdirectories and then compiling/executing the code. It is time consuming to copy the code to each location, and heaven forbid I need alter the code at some point. I would need to change (or copy) the code in each location. I hope that is a bit clearer.

Similar Messages

  • How to set path to run a Java program?

    my pc os is win2000 service pack 3.
    cpu is celoron 667mhz
    256 pc133 sdram
    i have done the setting b4 run a java program but no any effect.
    setting as below:
    set path=c:\j2sdk1.4.1_01\bin
    set classpath=c:\j2sdk1.4.1_01\lib
    my java file is store in C:\Java, file name is HelloWorld.java, so when i type:
    C:\>
    C:\>Java\javac HelloWorld.java
    (the screen show me : java\javac not internal or external........")
    and i try again as follow:
    C:>
    C:>\Java>javac HelloWorld.java
    (the screen show : Exception in thread "main" java.lang.NoClassDefFoundError:HelloWorld/java)
    i cant do anymore, who can help me?

    you need to put the CLASSPATH to dir: c:\j2sdk1.4.1_01
    and also to the directory you are working
    For example, you are working in "C:\Myclasses". You need to put:
    set CLASSPATH = C:\j2sk1.4.1_01;C:\Myclasses;
    if you don't put your working directory, java doesn't find your classes
    Try it and luck!

  • Setting Path variable in Win XP Pro

    Hello,
    I have installed Java SDK 1.3.0_02 on Windows XP professional.
    I have set my path to:
    %SystemRoot%\system32; %SystemRoot%; %SystemRoot%\system32\WBEM;
    %SystemRoot%; %SystemRoot%\system32\WBEM; C:\Program Files\Common
    Files\Adaptec Shared\System; %Java_Home%\bin; %Java_Home%; %Tomcat_Home%;
    where %JAVA_HOME% refers to C:\jdk1.3.0_02.
    I get the following error upon trying to use 'javac' in the DOS command
    prompt:
    'javac' is not recognized as an internal or external command, operable
    program or batch file
    According to the instructions at
    <http://java.sun.com/j2se/1.3/install-windows.html#Environment> I have done
    all I can. Also, according to this article I should not have to set a
    classpath variable. Should I set a classpath variable?
    Here are some conditions I cannot figure out:
    1) When I use the 'java' command with any switches (such as -version) I get
    a proper response.
    2) When I type on the command line "set path=C:\jdk1.3.0_02" and then try
    "javac" command it works. This happens only while the command window is
    opened. If it is closed and reopened I will have to do it again. This should
    not be required.
    3) When I navigate to the "C:\jdk1.3.0_02\bin" directory and try using the
    "javac" command it works fine.
    4) Everytime I use the 'autoexec' command in the C: root directory I get an
    old version of the path variable without my recent path settings.
    What do I need to do to simply open a command prompt and compile Java code?
    It seems to work fine on other installations. I want to be able to use
    'javac' from any directory without referencing in the command line the
    directory of 'javac'.
    My main question is how do I set the path variable so it permanently stays in
    Windows XP Pro? What is the simplist way to do this?
    Should it be set in the environmental variables section under 'My Computer'? Should it be set in DOS? Should it be set in 'autoexec.syd' in the C: root directory (there is not autoexec.bat)? Someone mentioned to set the
    Sincerley,
    Chris

    From the command prompt echo your classpath (echo %classpath%) and see what displays. If it's not the one from your environment variables, then something else is getting it's dirty hands in the way.
    You may want to take a look through your autoexec.bat and remove any lines that set the path variable. Leave it to your windows environment settings to do it for you.

  • How to set path in linux?

    Hi,
    I tried to compile a form in linux.
    I use the following command:
    export LD_LIBRARY_PATH=/u0/oracle/prodora/8.0.6/lib
    f60gen module=/u0/oracle/prodappl/ar/11.5.0/forms/US/TESTFORM.fmb USERID=apps/****
    An fmx is generated. But during compile it also give the following message:
    FRM-18108: Failed to load the following objects.
    Source Module:TEMPLATE.fmb
    Source Object: FRAME_HORZ_LINE
    Source Module:TEMPLATE.fmb
    Source Object: FRAME_RECT
    Source Module:APPSTAND
    Source Object: STANDARD_PC_AND_VA
    Source Module:APPSTAND
    Source Object: STANDARD_TOOLBAR
    Source Module:APPSTAND
    Source Object: STANDARD_CALENDAR
    I suppose it because it cannot found template.fmb and appstand.fmb.
    How do I include the path to this files? For example the path is this: /u0/oracle/prodappl/ar/11.5.0/forms/US
    Can I add it using the "export LD_LIBRARY_PATH" command?
    What is the syntax for multiple path for the "export LD_LIBRARY_PATH"?
    I cannot execute it one after the other as it seems the later overwrite the former.
    Thank you
    Jim

    I do:
    export FORMS_PATH=/u01/app/oracle/product/apps/your_source Will it overwrite any path in the FORMS_PATH, or will it add into it? Or is it not permanent?
    this is not permanent solution,your just setting path.
    Refer metalink note
    What is Difference between the Forms_path and the working directory? [ID 551511.1
    Edited by: Amigo on Dec 22, 2010 1:20 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to set Path on windows 98

    Hello!
    sorry for my bit knowledge on Java first.
    I am having a hard time to set a path in my windows 98.
    First, I did instal Java 2SDK version 1.4.0
    Then, I download j2EE RI server and documentation from sun's J2EE download site
    Then, I run the installer for both the J2EE and documentation
    then I did put these �set� command in a bat file.
    set JAVA_HOME = C:\j2sdk1.4.0
    set J2EE_HOME=C:\j2sdkee1.3.1
    set ANT_HOME=C:\ant\apache-ant-1.5.3.1
    set PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin;%J2EE_HOME%\bin
    My last step was to check all logging output to the current shell. So I went to the command line and type j2ee -verbose. However I got the following error message.
    Microsoft(R) Windows 98
    (C)Copyright Microsoft Corp 1981-1999.
    C:\WINDOWS\Desktop>j2ee -verbose
    Bad command or file name
    can you please help me how to correct this. I don't know DOS much so I may type something wrong.
    any help is appreciated.
    Kimbra

    Yes, I ran into the same problem on my Win 98 laptop. I used the exact same set command, but the problem was, it seems than Windows 98 forgets the set command after a shutdown/reboot.
    Go into your autoexec.bat file (should be in your C:\ drive, as in C:\autoexec.bat, or I think you can type sysedit into the Run prompt (Start > Run) ) and then type in:
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\j2sdk1.4.0\bin;
    That worked for my laptop; I was able to run the javac and java programs in any directory, without referencing the full directory path each time.
    Sorry, but I can't help you on the apache problem, although I suspect all you need you do is add that directory path onto the above line.

  • Unable to set path in win 98

    hi!
    i know it wud sound stupid but i am unable to set path variable in win 98. i added the line PATH=c:\j2sdk1.4.1_01\bin in autoexec.bat,
    then executed the statement c:\autoexec.bat and then checked the value of path variable. it works fine but when i try to run any java file like
    c:\javac Test.java the following error appears:
    error: cannot read: *.java
    1 error
    wat shud i do??????

    you should change into directory where you have these .java files, and then try again...

  • Linux - j2sdk1.4.2_06 can't set path/classpath

    I am struggling to get my java set up to write, compile and run some java programs, and honestly being a linux newbie the docs for such are somewhat confusing..
    I am trying to break this down as simple as possible.
    -I am logged into Linux as root.
    -then download the j2sdk1.4.2_06 in the /USR/ dir
    -I did chmod +x j2sdk1.4.2_06...
    -then./j2sdk1.4.2_06...
    it installed successfully.
    but setting up the path classpath is different.
    I would like two things:
    for my mozilla browser to now be java enabled, AND
    I would like to create a directory called javasrc to hold all my java source code
    but I do not want to develop in root, I want any user to be able to use the javasrc directory and be able to compile and run the programs..
    what exactly do I edit. someone said I need to edit a file in /ETC/PROFILE
    I want to try this..but I dont think it is correct
    export JAVA_HOME=/usr/j2sdk1.4.2_06
    PATH=$HOME:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/X11:/sbin:/home/mqm/bin:$JAVA_HOME/bin
    export PATHthanks

    I'd advice you to not touch CLASSPATH until you've studied how packages and classloading work. Until then it will just get on your way.
    What comes to setting PATH, the file to modify in /etc depends on your distribution -- a least in some versions of SuSE /etc/profile is generated by a script and you are supposed to modify /etc/profile.local instead. You could also edit a file called ".bashrc" in your home directory. The manual page of bash explains the differences between using these files. If you modify /etc/profile you need to either start a new login shell or source the file for the change to have effect. The lines to write are:export JAVA_HOME=/usr/j2sdk1.4.2_06
    export PATH=$PATH:$JAVA_HOME/bin

  • Need help with setting PATH in Windows 98

    Hi
    Can anyone please help me!!!
    I am new to java and I am confuse how to set the path in my pc. I have a windows 98, I downloaded the Java 2 SDK Standard Edition v 1.4.1 from the CD that came with the fifth edition "Java How to Program" book. I followed the instruction in how to set PATH permanently but it is not working. When I open my AUTOEXEC.BAT this is what I have:
    @ECHO OFF
    rem
    rem *** DO NOT EDIT THIS FILE! ***
    rem
    rem This file was created by the System Configuration Utility as
    rem a placeholder for your AUTOEXEC.BAT file. Your actual
    rem AUTOEXEC.BAT file has been saved under the name AUTOEXEC.TSH.
    rem
    SET PATH=%PATH%;C:\PROGRA~1\BORLAND\CBUILD~1\BIN;C:\PROGRA~1\BORLAND\CBUILD~1\PROJECTS\BPL
    @REM Added by MATLAB installer
    SET PATH="%PATH%;c:\matlab_sv12\bin\win32"
    PATH=%PATH%;C:\PROGRA~1\SSHCOM~1\SSHSEC~1
    REM >>>CS ChemOffice: Do Not Edit!
    path="c:\PROGRA~1\CHEMOF~1\COMMON\dlls";%PATH%
    REM <<<CS ChemOffice: Do Not Edit!
    I added the C:\J2SDK1.4.1\BIN and the end of PATH=%PATH%;C:\PROGRA~1\SSHCOM~1\SSHSEC~1 but it is not working. When I try to compile javac HelloWorldApp.java in MS-DOS Prompt I get "Bad command or file name".
    If anybody can please help, I'd greatly appreciate it...
    Thank you
    Gem

    I added the C:\J2SDK1.4.1\BIN and the end of
    PATH=%PATH%;C:\PROGRA~1\SSHCOM~1\SSHSEC~1 but it iswell, you could have written that directory wrong...
    are you sure that your java is in J2SDK1.4.1 ? for me
    that directory has _02 at the end of it as well...
    it also might be that you didn't separate your path
    element with ';'
    that's important too.
    you could try it from dos-prompt like that:
    set PATH=%PATH%;c:\j2sdk1.4.1\bin
    if it works from dos-prompt, then it should work in
    autoexec as well...
    HTHThank you very much for your help!!!
    I tried what you suggest set PATH=%PATH%;c:\j2sdk1.4.1\bin in the dos-prompt and it worked, but it didn't work in the autoexec.bat. I am getting "Out of environment space".
    Gem

  • Install jdk into WinME, how to set path?

    I just install WinME for my pc! However, the method to set path in WinME is different with Win98! I set the path in Win98 by using 'sysedit', however, WinME haven't got 'sysedit', then i tried to set path in 'msconfig'! But, it only allows us to set one path, how should i add one more paths?
    i can't run javac, it said msvcrt.dll has problem!
    what happen?
    I can set path in Win98 but winME is different.
    thank you

    Windows ME - To set the PATH permanently:
    From the start menu, choose programs, accessories, system tools, and system information. This brings up a window titled "Microsoft Help and Support". From here, choose the tools menu, then select the system configuration utility. Click the environment tab, select PATH and press the edit button. Now add the SDK ( e.g C:\j2sdk1.4.0-beta3\bin)to your path by Looking for the PATH statement. (If you don't have one, add one.) If you're not sure where to add the path, add it to the right end of the PATH.
    After you've added the location of the SDK to your PATH, save the changes and reboot your machine when prompted.
    hope this help

  • Set path for emacs

    Hi
    The emacs located in /opt/sfw/bin
    But how to set path for that so i can use emacs or other software in any other directory.
    I put
    set path=(/opt/sfw/bin $ path)
    in my home dir /export/home/joanna/.cshrc
    but it did not work.
    Which file should i modify and the format i put in ~/.cshrc is correct or not?
    Thanks
    Joanna

    The PATH variable is PATH and not path (The case of the shrinking Alphabets...?)
    And I think in the csh, it should be setenv and not set.
    BTW, csh is not really a good shell to be working on - use ksh instead.
    man csh
    man ksh

  • RMAN backup set path

    I am restoring the production database to testing server. i have taken the cold backup of my catalog database and refreshed on development server so that i can have information about the production db in RMAN catalog db.
    i have copied the backup sets ( level 0 ) of my production db to development server. backup set path is not identical as production. so When i try to recover in dev server i am getting error file not found. ( not able to find the backup piece ) since it is point to production backup set path.
    how do i set or update the RMAN database about my testing server backup set path so that during the recovery rman reads from new location on the development.

    thank you.
    I am facing problem while restoring the database.
    i trying to restore from level 0 backup which we take daily basis. when i use the below command and while restoring one of the datafile referring the old backup set which is not available. i have valid backup sets taken yesterday. but rman refers the backup sets taken on day before yesterday.
    i am using the following command.
    rman << EOS
    connect catalog rman/rman@PSMTRRCT
    set dbid 4151495469;
    connect target /;
    startup nomount;
    run {
    allocate channel c1 type disk;
    set until time "to_date('9/mar/2011 23:00','dd/mon/yyyy hh24:mi')";
    restore controlfile;
    restore database;
    alter database mount;
    exit
    EOS
    LEVEL 0 backup which i have was taken on 9 mar. but rman refers the 8 march backup set for one particular datafile. since i dont have that backup set. restore fails.
    can you please help.

  • Setting path and class path help

    I am a complete beginner who is currently starting a cd based tutorial!I have downloaded jdk1.1.6 which is the nearest developement kit to the one used in the tutorial.I use windows 98.When I try to set my path or class path as instructed in the docs, I cannot find any thing in the autoexec file at all.I have opened using notepad/Run and DOS edit but all three open an empty file.Where will I need to set up the path and class paths.My system must run these from somewhere else perhaps due to an update.

    Hi,
    Put the following statements in your autoexec.bat.
    <homepath> = Path of your JDK folder on the drive. e.g. c:\jdk
    SET CLASSPATH=;.;<homepath>\lib\tools.jar; .... continue with other jar files on the same line and seperate the entries by a semicolon.
    SET PATH=C:\WINDOWS\;C:\<homepath>\BIN\;
    This autoexec.bat must be on c:\. i.e. U can open it in notepad by giving c:\autoexec.bat in the File Open Dialog. It is possible for this file to be empty. Simply add the commands on the last line.
    Regards ,
    Karan

  • Setting Path Permanently

    This problem is taking up way too much time...
    So, I, like many others, want to set a global PATH variable for all users. I know you should do this in /etc/profile, but it doesn't work. In my etc/profile (before the last two lines) I have:
    export PS1="[\u@\h \w]\$ "
    export PATH=$PATH:/opt/csw/binThe PS1 variable is always changed (i.e. it looks like I told it to look), but the PATH variable never includes the folder I appended to it. (This is with root and nonroot users). I don't want to mess with .profile, .bashrc, etc. because this is supposed to be for all users. If I can help it, I'd also like to avoid editing /etc/default/login. Thanks in advance for the help.
    -Andy

    Also, I have another question. When I login to
    fluxbox or something, and I open up a terminal
    (loading sh), my PATH isn't set because sh doesn't
    source .profile or /etc/profile when invoked like
    that. Is there some file it does source, or some
    other way to set PATH?Ok, you logon locally to the box. You type sh to
    invoke bourne shell and your PATH does not carry over
    to the new shell?
    What shell do you originally log into?
    alanHere's the problem: Say I log in via fluxbox. /etc/profile is run, setting PATH, etc. Now I open a terminal which loads into sh, but does not run /etc/profile or .profile. Unfortunately, there is a script I want run every time I open a new shell session/terminal, and I want to set a few variables, including PATH via .profile. For some reason, probably logical because /etc/profile has already been sourced, opening a shell via terminal doesn't source either .etc.profile or, more importantly, .profile. Is there a way to get it to execute .profile every time I open a terminal? If you answer is to edit the menu and change the actual command opening the terminal, how do you do that in JDS? I couldn't find a way to do it.
    Thanks.

  • Setting path win98

    i've followed all instructions and i still have to use set classpath= to get java classes to work... can anyone tell me how to set path and it actually work?

    This is how i set up my classpath
    1.I have a directory c:\jdk1.3.1_02\classes
    2.Put BreezySwing package into the classes folder
    3.Use Wordpad to open the file c:\autoexec.bat
    4.Go to the very end of the file, and add the following two lines:
    path %path%;.;c:\jdk1.3.1_02\bin
    set CLASSPATH=.;c:\jdk1.3.1_02\classes
    The first of these lines adds the current directory, and the directory c:\jdk1.3.1_02\bin to the paths
    through which the Windows system looks when searching for files that implement commands. This
    will allow you to invoke the JDK utilities javac (Java complier), java (Java Virtual Machine) and
    appletviewer (utility for checking Java applets) from anywhere in your system.
    The second line directs the Java compiler to the correct place on your disk for accessing the classes
    provided in the BreezySwing package and any others you may add in
    the future. You will need to restart your computer.
    Good luck.

  • Class Path, Set Path

    Imm new to Java Techology...plz tell me in detail bout how to "Set Class path", ....In Detail...Bye

    To set class path
    we type
    set classpath= c:\j2sdk folder\lib;.;
    set path = c:\j2sdk folder\bin;.;
    setting these both will work out. in this .; ending means the class path will be available throught otu the command prompt where ever which ever folder it is..
    well for setting permanent in the system for win2000 OS
    right click on myComputer icon there from that option you select properties
    then you get a pop up window where you have few tabs in which last one is advanced -- click on it
    then you get there button placed vertically .... in which there is button callled Environment variables
    click on it... you will get an window...
    in that see the user variables box
    In this if there is a variable to see as classpath then append the path of j2sdk folder\lib;.;
    if not present then create a variable and set the name to classpath and value to the pathof folder\bin;
    similalry path in that also if exist then edit it and give path to bin folder of j2sdk folder..
    this will work out for you..
    All The BEst

  • Newby set $path

    Hi dear all,
    i have a newby question (I think).
    I have installed solaris 9 and now i like to setup Apache.
    When i run ./configure --prefix=/usr/local/apache  I get the error that make is not found.
    I have done a find / -name make and found make in /usr/ccs/bin now i think that i have to set a path env. to /usr/ccs/bin and mayby to /usr/ccs/lib
    I have be testing set path = $path /usr/ccs/bin and things like that.
    Now i have the following when i am trying echo $path
    /usr/dt/bin:/usr/bin:/usr/ucb:/etc:.:/usr/ccs/bin
    I think the .:/usr/ccs/bin part is wrong and must read simply ......./etc:/usr/ccs/bin:/usr/ccs/lib
    How do i remove the :.:/sur/ccs/bin part and replace it with :/usr/ccs/bin:/usr/ccs/lib ?
    And is this the correct way to work arround my "make not found" error while installing Apache?
    Regards,
    Johan Louwers.

    First off, not to sound condescending (which I probably will anyway): I suggest that the people asking these questions order a good Solaris reference book from Amazon. I can heartily recommend this one: http://www.amazon.com/exec/obidos/ASIN/007222598X/qid=1087539512/sr=ka-2/ref=pd_ka_2/104-6613636-3615953
    how can i set a path on runlevel 3 in /ect/rc3.d just make a script setting the PATH?You do not... Setting $PATH in a script will only set the path variable for the shell running that script. Hence the PATH setting will disappear again once the script finishes.
    Setting a $PATH per user depends on which shell that user is using:
    ~/user/.profile for ksh
    ~/user/.login for csh and sh
    Setting a systemwide $PATH again depends on the shells being used:
    /etc/.login for ksh
    /etc/profile for csh and sh
    Setting a $PATH for the shell you are currently running:
    PATH=[ new value ]
    export $PATH

Maybe you are looking for