Classpath when executed from shell file

Running my java app directly from the command line works fine.
The problem is when I create a batch file. This way, I have a Exception in thread main : java.lang NoClassDefFoundError. The batch file contains exactly the same command line I can execute with success directly from the command line. The current directory is the same in the two tests.
Have any idea ?

here is an example of a working shell script that works on Solaris for sure.. (I think it must work on Red Hat either)... It has some "extra" stuff like setting JVM properties through command line in case you ever need this. As you can see it is setting a couple of JARs to the classpath.
One thing you might want to check for it the mssing class is present in your jar file and if the package tree starts from the root of the jar. (i.e. : your com. package is the top level directory inside the jar).
#!/bin/sh
JAVA_HOME=/usr/j2se
MYPROGRAM_HOME=/export/home/user/myprogram
CP=$MYPROGRAM_HOME/lib/someArchive.jar:$MYPROGRAM_HOME/lib/log4j-1.2.8.jar
$JAVA_HOME/bin/java -cp "$CP" -server "-Dprogram.properties.file=$MYPROGRAM_HOME/config/program.properties" "-Dlog4j.configuration=file:///$MYPROGRAM_HOME/config/program.log4j.properties" "-Dmyprogram.home=$MYPROGRAM_HOME" Driver
------

Similar Messages

  • Applescript in Automator behaves differently when executed from inside Automator, or as an Automator application

    Hello everyone,
    I'm trying to execute an Automator workflow at startup, which I do by saving the workflow as an application, and adding it to the startup list, this works fine.
    My workflow works fine when executed from within Automator (ie clicking on the "Execute" button), but does not anymore when the Automator application is executed (ie. simply double clicking on my Automator file)
    I have narrowed it down to an Applescript inside my workflow which fails only when the application is executed from the finder (the step works fine from within Automator). The script automatically creates an ad hoc wifi network.
    The line which specifically fails is :
    set menu_extras to value of attribute "AXDescription" of menu bar items
    Anyone has any idea why executing the workflow from within automator, and executing it from the finder yield different results ?
    The crazy thing is that all this worked fine up until a few days ago, there might have been an update since (running Mavericks 10.9.2), but nothing game-changing.

    You will need to provide more than the one line of AppleScript you quote if you want a definitive answer.  (We can't even see which app you are addressing this to.)

  • Can you use a subquery when importing from a file?

    I was wondering if the DBMS_DATAPUMP API allows using a subquery (DATA_FILTER) when executing an import from a file?
    I am unable of limiting my data when creating the export file because my subquery requires a database link, which is not an option on the server I'm working on. So I'm wondering if I can limit my data on the import from a file, rather than the export?
    Thanks for any advice...
    ivalum21

    I was wondering if the DBMS_DATAPUMP API allows using a subquery (DATA_FILTER) when executing an import from a file?From the documentation I would say yes:
    SUBQUERY:
    Specifies a subquery that is added to the end of the SELECT statement for the table. If you specify a WHERE clause in the subquery, you can restrict the rows that are selected. Specifying an ORDER BY clause orders the rows dumped in the export which improves performance when migrating from heap-organized tables to index-organized tables.
    «

  • Expdp problem when executing from pl/sql transportable tablespaces

    Hello
    i have a very strange problem for which your assistance is really appreciated. i am applying the transportable tablespaces approach and i have a problem when executing expdp from commandline in comparison to the procedure generated to make the exact same thing.
    more precisely when running:
    expdp etl/etl dumpfile=TBSP090609_DMP.dmp logfile=TBSP090609_DMP.log directory=EXPDP transport_tablespaces=TBSP090609 transport_full_check=y
    the dmp file produced is over 200MB.
    when runng the below pl/sql code the volume produced is around 50MB. any idea what i am missing?
    job_handle :=
    dbms_datapump.OPEN (operation => 'EXPORT',
    job_mode => 'TRANSPORTABLE',
    job_name => 'export_tablespace',
    VERSION => 'COMPATIBLE'
    dbms_datapump.add_file (handle => job_handle,
    filename => dump_file_name,
    DIRECTORY => export_dir_name
    dbms_datapump.set_parameter (handle => job_handle,
    NAME => 'TTS_FULL_CHECK',
    VALUE => 1
    dbms_datapump.metadata_filter (handle => job_handle,
    NAME => 'TABLESPACE_LIST',
    VALUE => '('''
    || tablespace_name
    || ''')'
    dbms_datapump.start_job (job_handle);

    thanx you for your response. the problem was eventually managed to be resolved as follows:
    job_handle :=
    dbms_datapump.OPEN (operation => 'EXPORT',
    job_mode => 'TRANSPORTABLE',
    job_name => 'export_tablespace',
    VERSION => 'COMPATIBLE'
    dbms_datapump.add_file (handle => job_handle,
    filename => dump_file_name,
    DIRECTORY => export_dir_name
    dbms_datapump.set_parameter (handle => job_handle,
    NAME => 'TTS_FULL_CHECK',
    VALUE => 1
    dbms_datapump.metadata_filter (handle => job_handle,
    NAME => 'TABLESPACE_EXPR',
    VALUE => 'IN('''
    || tablespace_name
    || ''')');
    dbms_datapump.start_job (job_handle);

  • DB recovery crashes when executed from script, finishes OK manually

    Hello everybody,
    I have a DB restore script which I used/tested a lot of times. On the last run it crashed in the archivelog recovery phase, but I was able to open the instance when applying the remaining commands manually.
    DB is a 10g2 on Solaris 10, I have a full backup made with EMC NetWorker. After taking the backup, the machine was re-installed from scratch (OS, additional 3rd party software, Oracle software and backup client). A new, empty DB instance was also created.
    Restore script performs the following:
    - checks/creates directory structure needed by Oracle instance;
    - stops the listener;
    - shuts down the new instance;
    - startup mount exclusive, enable restricted session;
    - drops database instance via RMAN
    - recovers the orapw, spfile, tnsnames.ora and listener.ora files from the backupset;
    - stars the instance in nomount;
    - replicates the controlfile from a saved copy in the backupset;
    - mounts the instance;
    - starts the following RMAN sequence:
    run {
    set until $LAST_SCN_IN_BACKUPSET;
    allocate channel c3 type 'sbt_tape' parms 'ENV=(....)';
    restore database check readonly;
    recover database check readonly;
    release channel c3;
    sql 'alter database open resetlogs';
    - starts the listener.
    Almost all is performed OK, until the "recover database check readonly" command, where the recover crashes with the following messages:
    Starting recover at 18-FEB-09
    starting media recovery
    channel c3: starting archive log restore to default destination
    channel c3: restoring archive log
    archive log thread=1 sequence=17
    channel c3: reading from backup piece 09k7hb2h_1_1
    channel c3: restored backup piece 1
    piece handle=09k7hb2h_1_1 tag=TAG20090216T181752
    channel c3: restore complete, elapsed time: 00:00:36
    archive log filename=<...>/oracle/oradata/SNM/arch/arch_1_17_678643049.arc thread=1 sequence=17
    released channel: c3
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of recover command at 02/18/2009 19:58:19
    ORA-00283: recovery session canceled due to errors
    RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '<...>/oracle/oradata/SNM/arch/arch_1_17_678643049.arc'
    ORA-00283: recovery session canceled due to errors
    ORA-19755: could not open change tracking file
    ORA-19750: change tracking file: '/alcatel/oracle/oradata/SNM/bct.dbf'
    ORA-27037: unable to obtain file status
    SVR4 Error: 2: No such file or directory
    Additional information: 3
    Recovery Manager complete.
    The curious thing is that when I ran the following commands manually (from RMAN), the recovery was OK:
    run {
    set until scn $LAST_SCN_IN_BACKUPSET;
    recover database check readonly;
    (finished in a couple of minutes)
    sql 'alter database open resetlogs';
    (finished after a few minutes)
    lsnrctl start (from shell) - OK.
    Could somebody point me to the possible causes of this behavior?
    Thank you all for your time,
    Adrian

    Hi Werner,
    Thank you for your reply.
    Yes, I'm using the block change tracking file. As the DB instance was re-created when the machine was installed, the bct must have been created also. However, in my script I dropped the DB instance, and the bct was, most likely, deleted, as were all the other datafiles.
    After the restore script crashed, I had no bct file in the expected location (which is the location of all the datafiles).
    I'm wondering why the bct could not have been created during the run of the restore script.
    Looking through the alert log, I realise I tried an "alter database open resetlogs" before running the recovery sequence, and at that point, the bct was created.
    Then, the second attempt to open the instance was successfull - please see below the messages from the alert log:
    Thu Feb 19 09:43:47 2009
    alter database open
    Thu Feb 19 09:43:47 2009
    CHANGE TRACKING is enabled for this database, but the
    change tracking file can not be found. Recreating the file.
    Change tracking file recreated.
    Block change tracking file is current.
    ORA-1589 signalled during: alter database open...
    Thu Feb 19 09:43:54 2009
    alter database open resetlogs
    ORA-1196 signalled during: alter database open resetlogs...
    Thu Feb 19 09:48:04 2009
    alter database recover datafile list clear
    Thu Feb 19 09:48:04 2009
    Completed: alter database recover datafile list clear
    Thu Feb 19 09:48:04 2009
    alter database recover datafile list
    1 , 2 , 3 , 4 , 5 , 6 , 7 , 8
    Completed: alter database recover datafile list
    1 , 2 , 3 , 4 , 5 , 6 , 7 , 8
    Thu Feb 19 09:48:04 2009
    alter database recover if needed
    start until change 7033941 using backup controlfile
    Media Recovery Start
    parallel recovery started with 7 processes
    ORA-279 signalled during: alter database recover if needed
    start until change 7033941 using backup controlfile
    Thu Feb 19 09:48:05 2009
    alter database recover logfile '/alcatel/oracle/oradata/SNM/arch/arch_1_17_678643049.arc'
    Thu Feb 19 09:48:05 2009
    Media Recovery Log /alcatel/oracle/oradata/SNM/arch/arch_1_17_678643049.arc
    Thu Feb 19 09:48:43 2009
    Incomplete Recovery applied until change 7033941
    Thu Feb 19 09:48:43 2009
    Media Recovery Complete (SNM)
    Completed: alter database recover logfile '/alcatel/oracle/oradata/SNM/arch/arch_1_17_678643049.arc'
    Thu Feb 19 09:49:10 2009
    alter database open resetlogs
    <....>
    Thu Feb 19 09:50:47 2009
    LOGSTDBY: Validation complete
    Starting control autobackup
    Control autobackup written to DISK device
    handle '/alcatel/oracle/oradata/SNM/flash_recovery_area/SNM/autobackup/2009_02_19/o1_mf_s_679225849_4st3tswj_.bkp'
    Completed: alter database open resetlogs
    So, to recap:
    - bct file not created at first try (restore script);
    - bct file created during the failed attempt to open the db (manual command);
    - second attempt to open the db successfull (manual command).
    The behavior doesn't seem to be systematic, as I don't think this happens every time. In this case, I'm starting to wonder if it wouldn't be a good idea to disable the bct before starting the restore, and then to enable it back when the db is opened.
    Thank you again for your idea,
    Adrian

  • How To Set Third Party Media App Is Default When Launched From Default File Manager

    I use rock media player, which can encode & decode The Video and audio files i use, unlike the phone i have, i don't receive the option to set the app as the default media player. I would really like to be able to use this app on the thrive as it is some much a better media player than the thrives defaulty app. Rock player is the name of the app, who do set it as the default player when launched from the default file manager.

    From my experience playing with the Thrive, when you attempt to watch a media file, it will open a menu asking you what application to use. From that popup, you can set a default.
    - Peter

  • When reading from the file validate the date  'DD/MM/YYYY'  format

    Hi,
    reading from the file ,validate the date format 'DD/MM/YYYY'.
    Thanks & regards
    venkata

    I suppose that you are writing a program in some programming language, probably PL/SQL. So, you can use TO_DATE function and handle the exception when it occurs.
    create or replace procedure tstdt
    as
      stdt varchar(10);
      dt date;
    begin
      stdt := '20/10/2006';
      dt := to_date(stdt);
       dbms_output.put_line('date is correct
    exception
    when others then
      dbms_output.put_line('Invalid Date');
    end;[],
    Miguel

  • Unix script not working when executed from SAP PI communication channel

    Hi Experts,
    I am currently using the Run OS command after message processing functionality of the file adapter.
    However, the unix script doesn't seem to work when run via communication channel.
    The script runs properly when executed manually.
    The communication channel logs don't show any error as well.
    Do you have any ideas as to where the error might be.
    Thanks,
    Mike

    Hi All,
    Thank you for your replies. I appreciate this.
    @Anand, here is the script:
    #!/usr/bin/sh
    #version 1
    hostname=$(uname -a | cut -f 2 -d " ")
    MAILTO="[email protected] "
    homedir=$PWD
    echo $homedir | mailx -m -s "OB10 $hostname" $MAILTO
    /opt/java6/bin/jar -xvf OB10.zip
    ll | mailx -m -s "OB10 $hostname" $MAILTO
    What's puzzling me is that I am able to receive the email alerts.
    This means that the user has sufficient authorization to execute the script.
    But the unzip command is not working.
    I have seen the unzip work when run manually.
    Thanks,
    Mike

  • Classpath issues when executing from a jar

    I have a jar that I built for an RMI server that has a need to access another jar. (log4j). I run the jar from the command line using:
    java -jar -Djava.rmi.server.codebase=my.jar my.jar
    and the code runs fine but when I try to add in the log4j.jar I can't find it. I have placed it in my.jar in a lib directory within my.jar, I have placed it in the current directory, I have placed it in other directories I know are on the classpath, I have done all kinds of variations with the -classpath switch on the command line and nothing works.
    How do I package, configure and/or call such that the Logger class in log4j.jar can be found by my RMI server when I execute my.jar?
    Thanks

    Running from the jar-file ignores the CLASSPATH. See Bug #4459663
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4459663
    You have a few options:
    First, you can unjar all of the jars you depend on and rejar 'em up with your jar. This is the simplest solution.
    Second, you can skip running "from the jar" and just put that jar in your CLASSPATH.
    Third, you can put jars you depend on in the $JAVA_HOME/jre/lib/ext directory.
    Fourth, you can modify the manifest to specify a classpath, and then put the libraries you depend on at the places specified.
    And, if you think There Ought To Be A Better Way, vote for the RFE!

  • Find gives permission denied on files when executed from bash script.

    I've written a really basic script just to check what new music was added to my library over the past n days:
    #!/bin/bash
    echo "Check for days?"
    read days
    `find /home/tom/Music/ -iname "*.*" -type f -mtime -$days -print`
    If I run the find from the shell it runs fine but the script always gives this error:
    ./listNewMusic.sh: line 7: /home/MrGone/Music/Smod/SModcast-19.mp3: Permission denied
    Anyone know why?
    Thanks.

    It is because you're running the find command in a sub-shell.  What is returned by the sub-shell is being run by your script.
    Change:
    `find /home/tom/Music/ -iname "*.*" -type f -mtime -$days -print`
    to
    find /home/tom/Music/ -iname "*.*" -type f -mtime -$days -print
    Last edited by steve___ (2010-07-10 12:50:38)

  • Re: How do you specify an external jar and library when executing from a ja

    When you specify java -jar the -classpath argument is ignored and the jar's manifest file is used - see http://java.sun.com/docs/books/tutorial/deployment/jar/ .

    OK you know I read that somewhere and then totally forgot about it.
    I know this isn't the place to ask but I've had limited success with asking eclipse questions on their forums.
    Does anyone know how to export a jar file with the correct manifest from eclipse? My application works fine in eclipse but doesn't export a usable jar. To fix this I have to unjar the file, add the manifest text and rejar it.
    Thanks,
    Jim.

  • Error 26 when executing sql. File opened that is not a database file. My Easy System Cleaner will not work on Foxfire. What to do?

    I have the Easy System Cleaner. It worked through Internet Explorer. But when it comes to Mozilla Foxfire. It stops.
    The message is:
    error executing sql. Error 26. File opened that is not a database file "select[sql] from sqlite_master where [type]="table' and lower (name)='mos_cookies' " File is encrypted or is not a database.
    What should I do. And where do I look to solve this problem.
    I need to use my Easy System Cleaner...I paid for it!
    [email protected]

    How do I fix this error

  • Error in prepare cursor stmt, when executed from a cgi called from web apln

    We are facing with the following error message:
    Error Prepare cursor SELECT message FROM OPS$SVEERAMA.ERRORCODE ORDER BY message; error code: 549755810774, offset: 180388626432
    549755810774 is the sqlca.sqlcode when printed as long and is -3114 (negative) when printed as int.
    We are trying to execute a cgi from the web application, the cgi in turn tries to connect to the oracle database. The cgi script, tries to establish an oracle connection, and tries to execute a prepare cursor statement.
    We are using oracle 10g and proc - Pro*C/C++: Release 10.1.0.5.0, on linux x86_64 machine. We have two sqlca.h header files, one which has the struct sqlca's variables defined as long and the other as int. we are using the int one.
    Any help is much appreciated. Also if you can let us know what are essential for establishing a db connectivity from a cgi script.(any env variables, etc)

    All oracle error messages are negative number.
    /home/oracle>oerr ora 3114
    03114, 00000, "not connected to ORACLE"
    // *Cause:
    // *Action:I suspect that you have not successfully established a connection to the database. Unfortunately, I don't actually know what you need for CGI. I would check for other errors in the portion of the code where you establish the connection.
    John

  • Control panel error when installing from MSI file with JRE 7 update 21

    When I install JRE from the MSI file that I get from the user folder I get an error then I try to start Java Control Panel. Java applications works ok but I cant start the Control panel. If I uninstall Java and install it by executing the offline exe file the installation works fine and the control panel also works.

    Yes same problem here. I had a successful rollout with the MSI package and version 1.7 Update 17 on 1500 computers!
    I packaged the Update 21 and on my first test-clients the control panel crashes when I try to open it. But the setup ends successful without any error code all eventviewer entries are successful and it seems that the environment is running. Firefox plugintest was successful.
    Why doesn't offer Orcale the MSI files?! Since last year Java cost me o lot of time deploying Java. There is no update which you can release quickly because there are always bugs to deploy them.

  • Invalid Object Name When Executing from Report Manager

    I ran some code to create a modified view of ExecutionLog3 on a SQL Server 2012 instance.  The ReportServer and ReportServerTempDB were transferred from a 2005 instance and are still on that compatibility level. After creating the new view, I 
    created a report in SSDT and it runs fine.  I deployed the dataset followed by the report.  I went to Report Manager to test it and the report fails with the following:
    An error has occurred during report processing. (rsProcessingAborted)
    The execution failed for the shared data set
    'ExecutionLog'. (rsDataSetExecutionError)
    Query execution failed for dataset ''. (rsErrorExecutingCommand)
    Invalid object name 'ExecutionLog3_Modified'.
    The code for the view is below and it came from MSSQLTips.  Why does the report run fine from SSDT and fail in Report Manager?
    USE [ReportServer]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [dbo].[ExecutionLog3_Modified]
    AS
    SELECT
    EL.InstanceName,
    COALESCE(C.Path, 'Unknown') AS ItemPath,
    EL.UserName,
    EL.ExecutionId,
    CASE(EL.RequestType)
    WHEN 0 THEN 'Interactive'
    WHEN 1 THEN 'Subscription'
    WHEN 2 THEN 'Refresh Cache'
    ELSE 'Unknown'
    END AS RequestType,
    -- SubscriptionId,
    EL.Format,
    Parameters,
    CASE(EL.ReportAction)
    WHEN 1 THEN 'Render'
    WHEN 2 THEN 'BookmarkNavigation'
    WHEN 3 THEN 'DocumentMapNavigation'
    WHEN 4 THEN 'DrillThrough'
    WHEN 5 THEN 'FindString'
    WHEN 6 THEN 'GetDocumentMap'
    WHEN 7 THEN 'Toggle'
    WHEN 8 THEN 'Sort'
    WHEN 9 THEN 'Execute'
    ELSE 'Unknown'
    END AS ItemAction,
    EL.TimeStart,
    YEAR(EL.TimeStart) AS Start_Year,
    MONTH(EL.TimeStart) AS Start_Month,
    DATENAME(MONTH,EL.TimeStart) AS Start_Month_Name,
    DATENAME(DW,EL.TimeStart) AS Start_Day_Of_Week,
    DATEPART(WEEKDAY,EL.TimeStart) AS Start_Day_Number_of_Week,
    EL.TimeEnd,
    EL.TimeDataRetrieval,
    EL.TimeProcessing,
    EL.TimeRendering,
    CASE(EL.Source)
    WHEN 1 THEN 'Live'
    WHEN 2 THEN 'Cache'
    WHEN 3 THEN 'Snapshot'
    WHEN 4 THEN 'History'
    WHEN 5 THEN 'AdHoc'
    WHEN 6 THEN 'Session'
    WHEN 7 THEN 'Rdce'
    ELSE 'Unknown'
    END AS Source,
    EL.Status,
    EL.ByteCount,
    EL.[RowCount],
    EL.AdditionalInfo,
    C.Name,
    C.CreatedByID,
    C.ModifiedByID,
    C.Description,
    C.CreationDate,
    C.ModifiedDate,
    CASE
    WHEN C.TYPE=1 THEN 'Folder'
    WHEN C.TYPE=2 THEN 'Report'
    WHEN C.TYPE=3 THEN 'XML'
    WHEN C.TYPE=4 THEN 'Linked Report'
    WHEN C.TYPE=5 THEN 'Data Source'
    WHEN C.TYPE=6 THEN 'Model'
    WHEN C.TYPE=8 THEN 'Shared Dataset'
    WHEN C.TYPE=9 THEN 'Report Part'
    END AS Type_Description
    FROM
    ExecutionLogStorage AS EL
    LEFT OUTER JOIN Catalog AS C ON (EL.ReportID = C.ItemID)
    GO
    Lee Markum

    Hi Lee,
    According to your description, you can't process the dataset when viewing the report on report server. Right?
    In this scenario, as you can see the dataset name in error message is empty, and it says "Invalid Object Name". Because you have already created a view in your database. When you run this report again, this query be executed again so that you can
    not create another view with same name. So you just need to query the view directly when creating dataset. 
    Select * from ExecutionLog3_Modify
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

Maybe you are looking for

  • Safari cannot open pages, but firefox can.

    My daughters Mac Mini has started strange behaviour. Safari will not open most websites (says it can't connect), but Firefox can. This includes sites such as Google and Yahoo, that open on Safari on the other Macs in our home. Network diagnostics say

  • Uploading of Documents into Portal through KM

    Dear Experts. I am New using KM. I need display a page HTML using a link in the portal of Employee Self-Service. My idea is upload a page in the KM and get a URL and with this create a service(link) in the portal for call this URL. I never have used

  • Error message when running SBO 2007B PL12 Client

    Dear Experts, Upon a fresh installation on a client of SBO2007B PL12 Client and DIAPI, when I startup the client application, it prompt me the below error: The procedure entry point ?CompareNoCase@SBOString@@QBEHPBG@Z could not be located in the dyna

  • Launch a Wap browser from within the MIDLet

    I know that due to the sandbox model midlets are not allowed to access other applications on the phone. However, in MIDP 2.0, MIDlets are no longer restricted to run only in a sandbox, since there are new mechanisms, which provide a security policy f

  • User created datafiles not showing up in backup

    I've created two extra datafiles. One called USER_DATA the other TEMPORARY_DATA. Both are not being shown as backedup in Enterprise Manager (10g). I've looked in the system directory (Win2003) and notice neither has the extenstion ".DBF". The databas