• Post Reply Bookmark Topic Watch Topic
  • New Topic

Importing files in java  RSS feed

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this code, following files are imported in this source file
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.Hashtable;
import com.interwoven.cssdk.common.CSClient;
import org.apache.commons.lang.StringUtils;
import com.interwoven.cssdk.access.CSUser;
import com.interwoven.cssdk.common.CSClient;
import com.interwoven.cssdk.common.CSException;
import com.interwoven.cssdk.filesys.CSAreaRelativePath;
import com.interwoven.cssdk.workflow.CSExternalTask;
import com.interwoven.cssdk.workflow.CSTask;
import com.interwoven.cssdk.workflow.CSURLExternalTask;
import com.interwoven.cssdk.workflow.CSWorkflow;
Here surce file is in location "package com.teamsite.client". So other files that are being imported from location com.interwoven.cssdk.common.CSClient, should have common path upto "com" folder and within "com" dir there sould be dir "interwoven" and within this dir there should be other dir.
But when I check dir on server, I don't see any other dir than teamsite. This code workd fine without any problem.
So, how are these other files are getting imported in here ? Our environment is bit complex, but still files need to be in the path for being imported. We have repositories where jar is kept.

Thanks
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I might answer this question, but looking through your posting history it seems that you rarely come back to a topic to say that something worked, or didn't work, or indeed to say thanks for the help you got. I'm afraid it would be the same here, which does not exactly motivate me.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about thanks in advance ?

My apologies for not closing many threads. I will do that now on.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But when I check dir on server, I don't see any other dir than teamsite. This code workd fine without any problem.
So, how are these other files are getting imported in here ?

Presumably the class you are importing are in a jar that is on the classpath.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.;D:\iw-home\iw-perl\iwperl.exe;
C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;
C:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;
C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;
C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;
C:\PROGRA~1\IBM\SQLLIB\bin;
C:\PROGRA~1\IBM\SQLLIB\java\common.jar;

Thats everything I see in CLASSPATH. All of them are IBM related files. None of them seem to be the ones I am looking for. So how are the files being retrieved in source code ?
(I checked only zip files and not jar files)
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nirjari patel wrote:.;D:\iw-home\iw-perl\iwperl.exe;
C:\PROGRA~1\IBM\SQLLIB\java\db2java.zip;
C:\PROGRA~1\IBM\SQLLIB\java\db2jcc.jar;
C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip;
C:\PROGRA~1\IBM\SQLLIB\java\db2jcc_license_cu.jar;
C:\PROGRA~1\IBM\SQLLIB\bin;
C:\PROGRA~1\IBM\SQLLIB\java\common.jar;

Thats everything I see in CLASSPATH. All of them are IBM related files. None of them seem to be the ones I am looking for. So how are the files being retrieved in source code ?
(I checked only zip files and not jar files)


Well, you should definitely look into all the jar files in the classpath -- just assuming because they are located in a certain directory, that it is not there may be a bad assumption.

Also, assuming that your "bit complex" environment modified the bootstrap or extension area, perhaps you should confirm the location, and examine those locations as well.

Henry
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found something and I am trying to run following command

"C:\Program Files\Java\jdk1.6.0_25\bin>jar xf "C:\Users\nm2t\Desktop\JavaTest\JarTest5.jar" -C "C:\Users\nm2t\Desktop\jTest"
Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...
Options:
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-u update existing archive
-v generate verbose output on standard output
-f specify archive file name
-m include manifest information from specified manifest file
-e specify application entry point for stand-alone application bundled into an executable jar file
-0 store only; use no ZIP compression
-M do not create a manifest file for the entries
-i generate index information for the specified jar files
-C change to the specified directory and include the following file
If any file is a directory then it is processed recursively. The manifest file name, the archive file name and the entry point name are specified in the same order as the 'm', 'f' and 'e' flags.

Example 1: to archive two class files into an archive called classes.jar: jar cvf classes.jar Foo.class Bar.class
Example 2: use an existing manifest file 'mymanifest' and archive all the files in the foo/ directory into 'classes.jar': jar cvfm classes.jar mymanifest -C foo/ ."

But its not working. Is there something wrong am I doing in executing this cmd ? I ran it once as "C:\Program Files\Java\jdk1.6.0_25\bin>jar xf "C:\Users\nm2t\Desktop\JavaTest\JarTest5.jar"
and I think, it crteated a folder in bin dir. I want this folder to be created in a different dir. Thats why I am using "-C" option, but it does not seem to be working.

Please let me know, whats wrong in here.

Thanks
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

First, order matters. Take a look at the usage message again. Second, why are you extracting? Isn't listing the jar file to see if the class is present what you want?

Henry

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
" Isn't listing the jar file to see if the class is present what you want? "

what is meant by this statement ? How can I get the listing of content of a jar file ?

Thanks
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"x" is for extract, for list there's another option.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
I used t in place of x and it did list all the content of file in there. But I still want to extract jar file in another dir to see whats there in these files and modify some of the classes for tests.

Thanks again
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong, As advised by you as below in another post,
But to answer your question again. The command line is very specific, in both order, and what is required. In this case, the last parameter is mandatory, you need to specify what you want to extract -- which if you want everything, should be a "." (for the current directory).

I am executing command as shown below. It does not generate files in execjal dir
C:\Program Files\Java\jdk1.6.0_22\bin>jar xvf "C:\Users\Jignesh\Desktop\java2\execjar\examples.jar" .
C:\Program Files\Java\jdk1.6.0_22\bin>jar xvf "C:\Users\Jignesh\Desktop\java2\execjar\examples.jar" files ..
C:\Program Files\Java\jdk1.6.0_22\bin>jar xvf "C:\Users\Jignesh\Desktop\java2\execjar\examples.jar" files ...
C:\Program Files\Java\jdk1.6.0_22\bin>jar xvf "C:\Users\Jignesh\Desktop\java2\execjar\examples.jar" C "C:\Users\Jignesh\Desktop\java2\execjar" .


Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...

{ctxui}[vfm0Me], what does curly braces and box bracket mean ?

none of these is generating output in execjar dir or any other dir. Can you please show me how to run command with exact syntax ?

examples.jar is a executable jar and moved from "C:\Program Files\Java\jdk1.6.0_22\demo\jpda" dir in java path. Can we unjar an executable jar ? Can I copy a jar or an executable jar from java path and put it in another dir and then unjar it ?

Thanks

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!