Java command line run code question?

hello all:
I met a question and want to get some suggestion from you.
I have one file TestOne.java located in
folder "c:\temp\aaa" which contains only one file(TestOne.java).
package samples.java2beginner.gui;
import java.io.*;
public class TestOne {
     public static void main(String[] args) {
            System.out.println("hello world");
}I use the following command to compile this java code:
c:\temp\aaa\javac TestOne.java // everything is ok.
In order to run this program, I have to manually create
folder hierarch "samples\java2beginner\gui" in "c:\temp\aaa" and
use the command
c:\temp\aaa\java samples.java2beginner.gui.TestOne to run this program.
My question is: is there any method that I can directly run
this java program without manually create "samples\java2beginner\gui"
which is annoying?
thank you

hello atmguy and DevMentee:
Thank you for your great suggestion.
I guess I didn't say my question clearly.
The class file compiled from TestOne.java is TestOne.class which cannot be modified.(so i cannot erase the package line or any kind of modification)
I want to run the java program from command line.
currently I have to create "samples\java2beginner\gui" and copy TestOne.class to there.
My question is: given one class file only(so you only get the TestOne.class),
do you have method to run it from command line?
so at this case you don't know which package the .class belongs to.
You might think my question is silly. The reason I posted the question because
I found problems when I use jode to decompiler a class file.
JODE is a java decompiler from jode.sourceforge.net
Given the above class file "TestOne.class", I cannot use jode to decompile it, because I have to run jode with the following method:
c:\temp\aaa\java jode.decompiler.Main -cp samples.java2beginner.gui.TestOne
which in fact is impossible given only .class file?
because the reason we use jode is to decompiler, how can you know the package
structure before decompile?!
so the problem came to my original question.
thank you all.

Similar Messages

  • Simple Java Command-Line on Unix Question

    From the windows shell, the following command works fine:
    java -classpath MyJar.jar;. Test
    The class Test, in the current director, depends on files in MyJar.jar. However, when I open up the cygwin bash shell and try to execute the same command, I get this error:
    bash: /usr/bin/Test: No such file or directory
    It appears it's looking for Test in /usr/bin as opposed to in the current directory. Why is this happening and how can I get this to work in bash?
    I know it's kind of unix question, but I figured some one here could help.
    TIA,
    John

    How can I use aboslute classpaths within bash. For
    example, what it the bash equivalent of the
    following:
    java -classpath C:/Java;C:/Java/MyJar.jar Testjava -classpath /the/path/to/your/Java:/the/path/to/your/MyJar.jar Test
    Normally you will be using things relative to your home directory so yo can use
    java -classpath ~ /the/relative-path/to/your/Java:~/the/relarive-path/to/your/MyJar.jar Test
    or
    java -classpath $HOME/the/relative-path/to/your/Java:$HOME/the/relative-path/to/your/MyJar.jar Test
    Please don't use these blindly. Spend some time (half a day say) looking at the bash shell!

  • Parsing java command line output to a gui

    Dear All,
    I am trying to implement a search engine for a project, i have a java file called Searcher.java, which searches for a particular text or sentence and gives the output based on the number of hits on a particular document, the document with the max hits is displayed first and so on,all the documents are are stored in a text file, I am trying to create a GUI for this file, the gui would consist of a text box,submit button,a list and a text area , when a user enters the text to search all the entries are displayed in the list box and upon clicking the individual item in the list the description should open up in the text area.
    The problem i am encountering is that i am not able to parse the output of the searcher.java file onto the GUI, i have no clue as to how to implement it , i would really appreciate it if anyone could help me out.
    the code for Searcher.java is as follows
    import java.util.*;
    public class Searcher {
    /** Specify the work directory !! */
    private static final String rootDir = "C:/HR/GUIAssign/";//on PC
    // private static final String rootDir = "/research/gm/Java/IR/"; // on Unix
    private static final String stopWordFile = "iStopWords.txt";
    private static final String docCollFile = "iDocColl.txt";
    private static final String invertedIndexFile = "ioInvertedIndex.txt";
    private StopWordSet stopWords = new StopWordSet(rootDir + stopWordFile);
    private Stemmer stemmer = new Stemmer();
    private TextTokenizer tok;
    private TextParser parser;
    private InvertedIndex inv;
    /** Creates a new instance of Searcher */
    public Searcher(TextTokenizer tok, TextParser parser) {
    this.tok = tok;
    this.parser = parser;
    ReaderWriter rw = new TextFileReaderWriter(rootDir);
    inv = rw.readInvertedIndex(invertedIndexFile);
    List search(String query) {
    System.out.println("\nSearching for <" + query + ">.");
    List hits = new ArrayList();
    int nbOfDocs = parser.getNbOfReadDocs();
    System.out.println("\nSearching for <" + query + "> among " + nbOfDocs +
    " documents.\n");
    double scores[] = new double[nbOfDocs]; // initial values 0.0
    String term;
    tok.setText(query);
    while(tok.hasMore()) {
    System.out.println("\nNext term: ");
    term = tok.nextToken();
    System.out.println(term);
    if(stopWords.contains(term))
    continue; // this terms can be ignored
    term = stemmer.stem(term); // apply the stemmer to get the root
    System.out.println("\n\nInfo on the term \"" + term + "\":");
    IndexTerm indexTerm = inv.getIndexTerm(term);
    if(indexTerm == null)
    System.out.print("Not in the vocabulary.");
    else {
    System.out.print("It appears " + indexTerm.getTermFreq() + " times, in "
    + indexTerm.getDocFreq() + " documents:\t");
    Iterator itr = indexTerm.getIterator();
    while(itr.hasNext()) {
    DocFreq docFreq = (DocFreq) itr.next();
    scores[docFreq.getDocId()] += docFreq.getFreq() /* / indexTerm.getDocFreq() */ ;
    // create hits from documents that have non-zero scores
    for(int i = 0; i < nbOfDocs; i++)
    if(scores[i] > 0.0)
    hits.add(new Hit(i, scores));
    // sort them in descending order of scores
    Collections.sort(hits, new Hit.CompareByScore());
    return hits;
    * @param args the command line arguments
    public static void main(String[] args) {
    TextTokenizer tok = TextTokenizer.getTokenizer("alpha");
    TextParser parser = new DummyParser(rootDir, tok);
    Searcher searcher = new Searcher(tok, parser);
    List hits = searcher.search("trade and board coffee, stock x is common");
    Iterator it = hits.iterator();
    while(it.hasNext()) {
    Hit hit = (Hit) it.next();
    int index = hit.getDocIndex();
    Doc doc = parser.getDoc(index);
    System.out.println("\n\nDoc " + index + " has a score of: " +
    hit.getScore() + "\n*** " + doc.getTitle() + " ***\n" +
    doc.getText());
    this code runs perfectly and gives the output on the command line
    the code for the GUI is as follows
    import java.awt.* ;
    import java.awt.event.* ;
    import javax.swing.* ;
    import javax.swing.event.*;
    public class HRSearch extends JFrame implements ActionListener {
    // keep references to all event sources
    private JLabel searchLabel;
    private JTextField searchField ;
    private JButton submitButton ;
    private JScrollPane searchScrollPane;
    private JTextArea textArea ;
    public HRSearch()
              Container contentPane = /*this.*/getContentPane( ) ;
              JPanel submitPanel = new JPanel();
              submitPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
              searchLabel = new JLabel("Search: ");
              searchLabel.setEnabled(false);
              submitPanel.add(searchLabel);
              searchField = new JTextField("", 20) ;
              searchField.setEditable(true) ;
              searchField.addActionListener(this) ;
              searchField.setEnabled(false);
              submitPanel.add(searchField) ;
              submitButton = new JButton("Submit") ;
              submitButton.addActionListener(this) ;
              submitButton.setEnabled(false);
              submitPanel.add(submitButton);
              contentPane.add(submitPanel, BorderLayout.NORTH);
    JPanel mainPanel = new JPanel() ;
                   mainPanel.setLayout(new FlowLayout(FlowLayout.LEFT)) ;
              JList searchList = new JList() ;
              // searchList.setEditable(false) ;
              searchList.setVisibleRowCount(20) ;
              searchScrollPane = new JScrollPane(searchList);
              mainPanel.add(searchScrollPane) ;
              textArea = new JTextArea("", 20, 40) ;
              textArea.setEditable(false) ;
              mainPanel.add(new JScrollPane(textArea) /*, BorderLayout.CENTER */) ;
              contentPane.add(mainPanel, BorderLayout.CENTER) ;
    public void actionPerformed(ActionEvent e) {
    String text ; // response to action event
    Object source = e.getSource( ) ;
    if (source != searchField && source != submitButton)
    return; // not interested in other actions
    // get text, trim leading and trailing spaces
    text = searchField.getText( ).trim() ;
    try {
    textArea.setText(textArea.getText() + "\n" + " " );
    catch(NumberFormatException exc) {
    JOptionPane.showMessageDialog(
    this, // address of "parent" or "anchor" frame
    "Not a number !", // the error message
    "Number Format Exception", // title of this modal dialogue
    JOptionPane.ERROR_MESSAGE // nature of this dialoge
    public static void main(String args[]) {
              final JFrame f = new HRSearch();
              // f.setBounds(100,100,500,450);
              f.pack();
              f.setVisible(true);
              f.setDefaultCloseOperation(EXIT_ON_CLOSE);
    i am stuck at this point and dont know what to do , please help me out.
    regards
    harsha

    I'm not positive I understand your problem... but let me recap what I think it is, then provide a solution:
    Your searched program can be run from the command line, and prints out (using system.out) the data you want. But NOW you want to create a GUI class, that intercepts that output, and displays it on the screen, and you can't because its going to the output stream and you're GUI isn't able to get it.
    If this is the case, what you can do is add two constructors to your Searcher class:
    public Searcher()
    this(System.out);
    public Searcher(OutputStream out)
    this.out = out;
    The idea being, that if you don't specify an output stream, the output goes to the console like normal. But if you do specify an output stream, the data gets fed back to you. So then in your GUI, you can do some binding of PipedInputStream and PipedOutputStream so when the Searcher class prints out, it comes right through the pipe into your GUI where you are waiting to read it.
    If this wasn't your problem, sorry :(
    Best,
    -Riyad

  • Where is the documentation on the Java command line options.

    I know you can get them by running java.exe, but does Sun have a web page with a little more detail?

    Googling for
    java command line options site:java.sun.com
    Found this for 1.4. I imagine you should be able to find something similar for 5.0.
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html

  • Java command line purge not working after applying MLR 10

    Hi Gurus,
    After applying the latest patch MLR 10,
    java command line purge does not seem to work. I'm using the command
    java -ms1024M -mx1024M oracle.tip.repos.purge.PurgeManager purgeRuntime -start 07-APR-2009 -end 22-MAY-2009 Complete
    Before running the command i have set the environment using setenv.bat present in ip\install directory.
    Below error is observed when trying to purge the messages
    java -ms1024M -mx1024M oracle.tip.repos.purge
    .PurgeManager purgeRuntime -start 07-APR-2009 -end 22-MAY-2009 Complete
    Purge started, please wait...
    Purge failed
    Error -: AIP-11016: SQL error: java.sql.SQLException: ORA-06550: line 1, colum
    n 7:
    PLS-00905: object B2B.PURGE_RUNTIME is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.tip.repos.purge.PurgeManager.main(PurgeManager.java:1454)
    Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00905: object B2B.PURGE_RUNTIME is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
    :124)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:315)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:281)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:638)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.
    java:183)
    at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableS
    tatement.java:872)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
    nt.java:1085)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePrep
    aredStatement.java:2983)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
    edStatement.java:3056)
    at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallab
    leStatement.java:4295)
    at oracle.tip.repos.purge.PurgeManager.main(PurgeManager.java:1449)
    Kindly let me know if any post install scripts needs to be run ?
    Or is there any thing else i have missed.
    Thanks in advance,
    Regards,
    Cema
    Edited by: Cema on May 22, 2009 12:14 PM

    Hi Cema,
    In MLR 10 these two bugs have been added with others (you can see in patch read me file)-
    8432093 - AUTOMATE THE POST PATCH INSTRUCTION SCRIPTS FROM MLR 10 ONWARDS
    8339176 - B2B PURGE_RUNTIME PROCEDURE DOES NOT DELETE ALL TIP_WIREMESSAGE_RT RECORDS
    Bug 8432093 tells clearly that there is no need of running any post installation script from MLR 10 onwards, so you have not missed anything like post installation script.
    Bug 8339176 has addressed the PURGE_RUNTIME functionality for deleting messages. From your earlier posts it seems that you got some errors while applying this patch. Please make sure that patch is successfully installed on your system.
    Regards,
    Anuj

  • JAVA command line options -cp and -jar don't work together?

    Running JSDK 1.4.2 under Windows. I have a Java application that tries to dynamically load a class name that the user enters as follows:
    try {
    classResult = java.lang.Class.forName(strFilterName);
    catch (ExceptionInInitializerError e) {
    strErrorMessage = "ExceptionInInitializerError loading class: " + strFilterName;
    catch (LinkageError e) {
    strErrorMessage = "LinkageError loading class: " + strFilterName;
    catch (ClassNotFoundException e) {
    strErrorMessage = "ClassNotFoundException loading class: " + strFilterName;
    This works fine if the classes that make up my application are left as class files in the classpath, but fails to work if they have been collected and run from a JAR file. Note: I can even dynamically load the class when running from the JAR file, if the class I'm trying to load is within that JAR file too. The problem really occurrs when the dynamically loaded class is located someplace else in my classpath. I've tried using various combinations of the "-cp" and "-jar" Java command line options - but when loading and running from a JAR file - the "-cp" parameters seem to be ignored. Is this a bug? Has anyone ever seen this before?
    I run my program from the JAR file using this command:
    java -cp .;e:\entmgr\filters -jar EntMgr.jar
    Where "e:\entmgr\filters" is where the class I'm trying to dynamically load is. (This class has no package name, but loads perfectly as long as I'm not running the application from the JAR file). The class name specified by the user has to be fully specified with a package name (if it has one).
    I have tried forcing the "java.lang.Class.forName(strFilterName);" call to use the system class loader, the parent of the system class loaded, and even the null bootstrap class loader - all with no success.
    I am suspecting that the class loader that is loading and running my main program from the JAR file, is just not paying any attention to the "-cp" parameter when the "-jar" parameter is present. Indeed, I have never seen any change in the failure, no matter what I put in the "-cp" parameter when using the JAR file.
    When I run this without using the JAR file, here is the command I execute:
    java -cp .;davidp\snmp;filters davidp.snmp.EntMgr
    Where this is executed in a directory that has a "filters" and "davidp\snmp" directory. In this case, because the "filters" directory is in my class path - I can dynamically load my class from it using just its simple name (i.e. "TestTrapFilter").
    So, is there some bug that precludes the "-cp" parameter from working correctly when the "-jar" parameter is used? Is there some other way to initialize or set up the classloader I'm using, so it can find things outside of the JAR file I'm running from? I would hope that it is possible to get the same behavior from my program, no matter if it is run from a JAR file or not.
    Thanks for any assistence!
    Dave

    These posts are pretty old, but this page came up in a google search while I was having the same problem, so I thought I would throw my own (Later found) solution in.
    The -cp and -jar options did not work together for me, but I later learned that they didn't really have to (and you don't have to mess with jar manifest files).
    While on the command line, if you want to set a specific class path and also run a jar, all you need to do is add the jar to whatever extra class path you need to use in the -cp <arg>, and then specify which class you want run from inside the jar.
    IE:
    java -cp <YourSpecialClasspath>: <PathToJar> <ClassToRunInsideOfJar>
    in my case it was like:
    java -cp /home/user/WebRCP.jar:./StandaloneInstaller.jar InstallLoader
    Remember to put a ":" in between the two arguments for the class path (-cp).
    Hope this helps someone in the future,
    -Josh

  • Importing .eex using Java Command Line on Unix (Licence required?)

    Hiall,
    We're looking into scripting our deploy process to reduce the amount of manual intervention required. We'll be importing the eex from a Unix box and was wondering what the licencing restrictions are on using the Java Command Line tools.
    Do we need a licence for them? Which kind? Desktop or Administrator?
    We already have Desktop licences but would rather not have to buy an additional one just for this process.
    Thanks for any help you can offer.

    Hi
    The Java Command Line Utility for the EUL is licensed with the Admin edition so you'll need to purchase at least one Admin license (at current prices these are $5,000 per administrator).
    Personally, I've always found scripting to be as much a manual process as entering the Admin tool and using the GUI interface.
    Best wishes
    Michael

  • Java - Command Line Arguments. Noob.

    Hi I am following a book and I can't seem to understand what it is trying to say
    1) Open your text editor, and write a public class called Book.
    2) Add main() within your Book class.
    3) The title will be args[0] and the author will be args[1]. You need to
    concatenate ?Title: ? with args[0], which is done by using the + operator.
    public class Book {
        public static void main(String[] args) {
            args[0] = "Rising Sun";
            args[1] = "John";
            System.out.println("Title: " + args[0]);
            System.out.println("Author: " + args[1]);
    }I have having trouble working out how to configure the args[0] and args[1]. Please tell me where they should be going. Thanks.

    You don't set args[0] and args[1] in your code. They are passed to your main from the command line by the JVM.
    java -cp . Book "Rising Sun" JohnWhen your main method is invoked, args[0] will be "Rising Sun" and args[1] will be "John".
    If you're running your program via an IDE, like NetBeans (which you shouldn't be doing this early in your career), then there will be someplace to configure what command line args to pass when it invokes your code. Set the title and author there.

  • Execute external java command line in Java

    But I can not get any result ( It does not create file test.svg) . the code is as follow
    Runtime.getRuntime().exec("java -jar c:/XSLT/saxon7.jar ../webapps/wfscontroller/gml.xml ../webapps/wfscontroller/SVG.xsl > ../webapps/wfscontroller/test.svg");
    If I execute "java -jar c:/XSLT/saxon7.jar ../webapps/wfscontroller/gml.xml ../webapps/wfscontroller/SVG.xsl > ../webapps/wfscontroller/test.svg" in DOS command. it works.
    Anybody knows what happened?
    Many thanks in advance.

    The > is interpreted by the shell. When you use Runtime.exec, you don't go through the shell, you exec the executable directory. So when you exec that command, you're passing ">" as an argument to "java -jar c:/...", and chances are the main() method in that doesn't interpret ">".
    So the upshot is you can't use ">", "|", "<", etc., that you can in a shell, with Runtime.exec().
    Other options are to run a batch file which invokes that command line.
    Or, you can get the standard output from the exec'ed process, and save it to a new file yourself.

  • Java command line in File adapter

    Hi all,
    In my receiver file adapter (FTP), I want to use the option "Run operating system command after message processing".  In the command I want to execute a java class.  Can anybody have information about how to do that ?
    My command line in the following : "java myPackage.MyClass %F". This command line works fine on my machine but I don't know how to do when on XI File Adapter (where to set the jar file, ...)
    Thanks in advance,
    Laurence

    Hi Laurence
    XI Command Line Functions::
    /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
    1)Windows batch Commands::
    http://labmice.techtarget.com/articles/batchcmds.htm
    2)Linux:
    /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
    regards
    Piyush
    Pl: reward points if it is helpful.

  • How to "Reload Domain" via Java / Command line

    Hi,
    I am looking for a way to do the same as the button "Reload Domain" in enterprise manager does, but I need to do it from command line or from java.
    We have multiple CMSDK nodes running on different servers. As the ifsctl command runs into very long timeouts if any of the servers is unavailable, we implemented a small java service that's deactivating all nodes in the node configuration table if the servers becomes unavailable. We need this as we have only a very tight timeframe for failover scenarios, so we cannot accept that the ifsctl takes a long time during startup.
    The problem we now have is that the Domain Controller remembers the configuration as it was during startup. So if any Node was disabled and is started later, the node guardian is not contacted by the domain controller. If the "Reload Domain" button is pressed, the domain controller refreshes it configuration and the additional nodes start their services.
    The whole stuff runs within Veritas Cluster, so we need to find a way to get everything up without manual intervention (pressing the button in enterprise manager).
    Thanks for any advice / help
    Alex

    Assuming your are using Ant underneath the covers to build inside of NetBeans (often the case), you can go to the directory where your NetBeans project resides and run "ant" from the command-line for the project's root directory (there should be a build.xml file in that directory). To do this, you'll need to have Ant installed (including having ANT_HOME defined in your environment) and you'll need to have JAVA_HOME defined in your environment and pointing to your Java SDK directory. This may sound like a lot of work (downloading and installing Ant and setting the environment variables), but it is probably the easiest way to build your NetBeans project from the command-line because it is likely that your particular NetBeans project is already using Ant to build. In fact, instead of downloading Ant, you could use the NetBeans installation of Ant as long as your ANT_HOME points to the NetBeans-provided Ant directory. You'll probably want to add $ANT_HOME/bin or %ANT_HOME%\bin to your PATH as well so that that can run "ant" from any directory.

  • Java command line programming in windows

    Here's what I want to do:
    -write .java files in a text editor
    -compile and run them from a command line, rather than using a
    compiler like codewarrior or MS J++
    Here's my problem:
    In a program that produces output, I can't seem to find a way to
    retain the output that goes off the screen in a DOS window. Is there
    a way to enable scrolling in a DOS window, or are there any
    alternative command line terminals for Windows? Any suggestions
    would be greatly appreciated.

    I think you can increase the Screen Buffer size which should give you a scroll bar. For this right click on the icon on the top left of the DOS window -select Properties - Go to Layout tab.
    Another option will be to redirect the output to a file
    java SomeClass > log.txt
    Hope this helps.

  • Reports6i - RWRUN60 command line exit codes - Help

    Basically I'm running a process in C# that execute multiple reports through Process.Start() method, once completed I'm checking the Process.ExitCode to verify if it was a successful execution.
    In the arguments for the command line execution I'm passing the ERRFILE=ErrorFile.txt argument to have an error log,.
    Usually after a successful execution, by 'standard' (actually best practice I think), the exit code of an application is 0, but in some reports I'm having exit codes like 4, and no errors are logged in the ERRFILE.
    I've checked the Reference Manual already, but I can't find any reference to command line error/exit level/code.
    If somebody has the RWRUN60.exe process exit codes I'd appreciate it.
    Thanks in advance.

    Please find the below code.
    I am not sure whether it is useful to you.
    DISPLAY=3.37.8.165:0.0;
    export DISPLAY
    #FTP ROUTINE
    ftp_proc()
    { if test -f $output_file/$output_file_web
    then
    a=`wc -l $output_file/$output_file_web| cut -c1-8`
    if [ $a = "" -o $a = "0" ]
    then
    echo 'FTP not required for $output_file_web because it has zero lines'
    $sh_path/crt_arch.sh $output_file $output_file_web $arch_file m
    else
    echo "ftp $output_file_web File"
    $sh_path/ftp_put_bin_script.sh centerpieceprod.motors.ge.com ftprpt test123 \
    $output_file $output_file_web /u03/app/applmgr/homepage/reports \
    $output_file_web $ftp_mode
    $sh_path/crt_arch.sh $output_file $output_file_web $archive_path m
    fi
    else
    echo 'WARNING : $output_file_unix file does not exist'
    fi
    unset a
    ## *** PROCESS STEP 010 ***
    ## Set environment, establish ID/password variables and process variables
    echo 'STEP010 : Setup variables and environment\n'
    echo 'STEP010 : Start Time - \c';date
    #!/bin/ksh
    #1###### Set the enviroment like APPS_SID, STEL_SID ##############
    CONST_ENV=$1                    
    . /var/opt/ge/bin/constell_environment $CONST_ENV
    if [ $? -ne 0 ]
    then
    echo "Environment not set\n"
    exit 1
    fi
    ####### Set the oracle environment for constellar database like NLS_LANG
    ORACLE_SID=$STEL_SID
    . /opt/bin/SET_environment
    ####### Get DB user and Password ########
    USER_PW=`/var/opt/ge/bin/GE_pw $STEL_SID $APPS_DB_USR`
    if [ $? -ne 0 ]
    then
    echo "Failed to get constellar password - "
    exit 1
    fi
    login=$STEL_DB_USR
    passwd=$USER_PW
    instance=$STEL_SID
    PRINTER=ps264laser1
    export PRINTER
    connect_str=$login/$passwd
    ##----------## Establish environment variables
    sh_path=$GESTEL_TOP/bin; export sh_path
    plsql_path=$GESTEL_TOP/plsql; export plsql_path
    tmp_path=$GESTEL_TOP/tmp; export tmp_path
    output_file=$GESTEL_TOP/out; export output_path
    input_path=$GESTEL_TOP/in; export input_path
    log_path=$GESTEL_TOP/log; export log_path
    archive_path=$GESTEL_TOP/archive; export archive_path
    scr_path=$GESTEL_TOP; export scr_path
    idw_name='REPORTS'; export idw_name;
    DISPLAY=3.37.8.165:0.0; export DISPLAY
    # <<<<<<<<<<<<<<<<<< M A I N P R O G R A M >>>>>>>>>>>>>>>>>>>>
    echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
    date "+%D %T Begin of the REPORT process."
    echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
    echo STARTING $0 `date +%c`
    echo $connect_str
    DAY=`date +%a`
    echo day of week is $DAY
    echo start batch jobs always executed
    echo start MSCP$plant programs always executed
    if [ $DAY = Sun -o $DAY = Mon ]
    then
    ## Build temp table containing all purchase orders ##
    sqlplus $connect_str @$plsql_path/exec_pop_tbl.sql
    fi
    # POPULATE THE IN SHIP TABLE AND THE OPEN PO TABLES
    echo "Executing Interface for Reports data\n"
    ## Build temp table containing all purchase orders ##
    sqlplus $connect_str @$plsql_path/create_open_po_report_tbl.sql
    ## Generate Receipt table for reports ##
    echo "Executed Interface for pos Reports data\n"
    sqlplus $connect_str @$plsql_path/crt_idw_rcpt.sql
    ## Look for any errors in HUB_SCHEDULE_TRACE table
    sqlplus $connect_str @$plsql_path/test_error.sql $idw_name $tmp_path
    unset a
    a=`wc -l $tmp_path/test_error.spl | cut -c1-8`
    if test $a != "0"
    then
    echo "\nERROR : Creating tables for reports\n"
    sqlplus $connect_str @$plsql_path/send_mail_msg.sql
    sqlplus $connect_str @$plsql_path/send_prod_support_mail.sql \
    $inf_rado $tmp_path
    exit 100
    fi
    echo '123'
    # FOR EACH PLANT IN THE TABLE,GET PLANT CODE
    echo '124'
    ######## Get password for apps ##########
    ORACLE_SID=$STEL_SID
    . /opt/bin/SET_environment
    unset TNS_ADMIN
    USER_PW=`/var/opt/ge/bin/GE_pw $STEL_SID $STEL_APP_USR`
    if [ $? -ne 0 ]
    then
    echo "Failed to get Apps password - "
    exit 1
    fi
    apps_conn=$STEL_APP_USR/$USER_PW
    echo '\nApps connected '
    echo $login
    echo $passwd
    for x in `sqlplus -s $apps_conn <<-MMM
    set pages 0
    set feedback 0
    SELECT
    TRANSLATE(RPAD(PARAM_VALUE,3),' ','x')||param_desc CODE
    FROM GECV_INT_PARAMS
    where interface_code = 'DLY_REPORTS'
    and param_code = 'Plant code and printer'
    EXIT
    MMM
    `
    do
    plant1=`echo $x | awk '{print substr($0,3,1)}'`
         echo $plant1
    if [ "$plant1" = "x" ]
    then
    plant=`echo $x | awk '{print substr($0,1,2)}'`
    else
    plant=`echo $x | awk '{print substr($0,1,3)}'`
    fi
    echo $plant
    box=`echo $x | awk '{print substr($0,4,length($0))}'`
    echo $box
    DAY=`date +%a`
    echo day of week is $DAY
    echo 'Start Time - \c';date
    echo start MSCP$plant programs executed on sunday or monday
    #DAILY RECEIVING FOR EACH PLANT
    echo $output_file
    #echo ' The Printer Name is : '
    #echo $PRINTER
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/rcvd1.rdf userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'rcvd1.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'rcvd1.txt'
    output_file_web='rcvd1'$plant'.doc'
    # Verify the day of the week to do put or append
    if [ $DAY = Sun -o $DAY = Mon ]
    then
    ftp_mode=append
    else
    ftp_mode=put
    fi
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    #PLANT CODE PHL THEN RUN DIFF REPORTS
    if [ $plant = PHL ]
    then
    REP_POPLT=phl_poplt.rdf
    REP_POPD=phl_popd.rdf
    REP_POANA1=phl_poana1.rdf
    REP_POANA2=phl_poana2.rdf
    else
    REP_POPLT=poplt.rdf
    REP_POPD=popd.rdf
    REP_POANA1=poana1.rdf
    REP_POANA2=poana2.rdf
    fi
    echo $REP_POPLT
    #OPEN PURCHASE ORDERS
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/$REP_POPLT userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'poplt.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'poplt.txt'
    output_file_web='poplt'$plant'.doc'
    ftp_mode=put
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    #PAST DUE PURCHASE ORDERS
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/$REP_POPD userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'popd.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'popd.txt'
    output_file_web='popd'$plant'.doc'
    ftp_mode=put
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    #PURCHASE ORDERS BY ANALYST
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/$REP_POANA1 userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'poana1.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'poana1.txt'
    output_file_web='poana1'$plant'.doc'
    ftp_mode=put
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    # PURCHASE ORDER BY PART
    # skl.run model for oracle reports executables
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/$REP_POANA2 userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'poana2.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'poana2.txt'
    output_file_web='poana2'$plant'.doc'
    ftp_mode=put
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    echo start MSCP$plant programs always executed
    if [ $DAY = Sun -o $DAY = Mon ]
    then
    ## Build temp table containing all purchase orders ##
    # skl.run model for oracle reports executables
    # RECEIVING LOG BY WEEK
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/rcvw1.rdf userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'rcvw1.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'rcvw1.txt'
    output_file_web='rcvw1'$plant'.doc'
    ftp_mode=put
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    # RECEIVING LOG BY ACCOUNT
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/wacsum.rdf userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'wacsum.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'wacsum.txt'
    output_file_web='wacsum'$plant'.doc'
    ftp_mode=put
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    # COMMITTED DOLLAR DETAIL REPORT
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/cmtdet.rdf userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'cmtdet.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'cmtdet.txt'
    output_file_web='cmtdet'$plant'.doc'
    ftp_mode=put
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    # COMMITTED DOLLAR SUMMARY REPORT
    ORACLE_HOME=/u04/app/applmgr/DFWPR107ora/8.0.6
    rwrun60c report=$sh_path/cmtsum.rdf userid=$login/$passwd@$instance \
    destype=file desname=$output_file/$plant'cmtsum.txt' batch=yes ctrplt=$plant \
    pagesize=132x66 desformat=wide180
    output_file_unix=$plant'cmtsum.txt'
    output_file_web='cmtsum'$plant'.doc'
    ftp_mode=put
    $sh_path/report_ascii_to_rtf.sh $output_file_unix $output_file_web
    ftp_proc
    fi
    done
    echo end MSCP$plant programs always executed

  • Translating command line run app

    I had an example which was passed parameters through the command line. The example says
    * To run this example, type the following on a command line:
    java -cp cookbook.jar BasicScript script-file file-out
    * where
    * script-file is a file containing the ActionScript that will be executed to
    * control the movie clip.
    * file-out is the path where the file will be written. If no output file
    * is specified then a file named after the example will be written to the
    * current directory.Then in the main method, it has a line
    String out = args.length == 1 ? "BasicScript.swf" : args[1];I dont really want to be using my app theough the command line, so I was trying to translate the above line. If I was to recreate this String myself, what would it look like?
    cheers

    nick2price wrote:
    Thanks. It was the ?: I had never seen before. So in essence, I can just remove everything from that line a just assign it a String which holds the filename
    String out = "BasicScript.swf";
    If you always want to use that file name, and not pass one in from the command line, then yes, you can get rid of the part that says, "If the one from the command line exists, use it, else..." and just leave the hardcoded file name.

  • Getting error when using the "/parameter" switch in command line run

    Has anyone experienced this problem before?
    My report queries over 100,000 records from a view. When the report is run from the command line every thing works fine.
    But when I add a condition using a "parameter", although the report still runs fine from the destop, when launched from the command line it errs.
    "Oracle Discoverer Desktop has encountered a problem and needs to close. ..."
    "The instruction at "0x0044397c" referenced memory at "0x0000004e". The memory cound not be "read"...."
    I'm guessing its a memory issue with my PC. I've tested using a parameter with other reports using fewer records and it doesn't err from the command line.
    I can work around the issue by not using a parameter but then I have 20 versions of the same report each with a different condition.
    Any suggestions would be appreciated.
    Lise McGillis

    Hi Michael,
    I'm using an DELL Intel Pentium 4 CPU 3.00 GHz with 1 GB of RAM. We use Microsoft Windows XP Prof version 2002.
    As for Discoverer we are using 10G, Desktop Client 10.1.2.48.18 - 1047500 KB available memory , 2099744 KB Free disk space.
    I'm not sure I have acess to a computer with more RAM but I'm looking into it.
    What I'm frustrated by is the fact that the parameter works fine when run directly from the desktop but when passed from the command line it bombs... but only when dealing with mega records.
    Lise.

Maybe you are looking for