Environment variables interfering with jar - classpath

I have a jar file, which works in many machines. However we just asked for a new unix user to install it, and it is not behaving the same... wonder if it could be anything related to some env. var.
the basic idea is:
WorkingUser#box$ java -jar install.jar -h
[output help instructions]
but then
NewUser#box$ java -jar install.jar -h
The java class is not found: pkg1.pkg2.pkg3.Loader
Before anyone asks, there is not classpath needed and yes, the cksum for the jar is ok. in fact:
$ jar tf install.jar
META-INF/
META-INF/MANIFEST.MF
pkg1/
pkg1/pkg2/
pkg1/pkg2/pkg3/
pkg1/pkg2/pkg3/script/
pkg1/pkg2/pkg3/Loader.class
pkg1/pkg2/pkg3/LoaderHelper.class
package.jar
And you can figure that the MANIFEST.MF is fine, since it works in other users.
I have tried executing with -cp install.jar with no success. Also the $CLASSPATH for working and not working users contains only ".".
any clues?
thanks,
f.

I'm copping the answer from davey in serverfault to have this closed. follows.
Try copying the file to /tmp or /var/tmp and running the install from there. Does it get further/succeed?
[EDIT]
This was pretty close to the actual problem. I ended up doing a similar test which worked and which with some testing lead me to find that the mount point permissions were wrong, i.e. the folder where the user's fs is mounted belongs to root and had access 774 (no exec to others).
I find always fascinating how wrong permissions in a low level cause the most adverse effects in the upper layers. I had (and I'm still not quite sure of it) that the permissions of the mount point had affect the mounted fs...
Anyways, we gave it the exec permission and voilá, java finds it's classes. There are more problems with this whole installation, but these might go to other questions :)
Thanks all.

Related

provide wrong classpath for netbeans [duplicate]

I need to make a GUI Application for my class , so I want to make sure I can transfer a netbeans project using the GUI Builder (I know how to make it without it, but that's more time consuming and I think it would look neater without me guessing coordinates etc. and I was use to the netbeans GUI builder) from netbeans onto unix and compile it. So here's what I did I made a new JFrame form (using netbeans GUI Builder) called StartFrame.java and another called MenuFrame.java. (keep in mind that it ran with no errors in netbeans) StartFrame creates a new instance of MenuFrame and opens it on it's first run. So I transferred all of it onto the unix system. So at first I tried compiling it, but of course it got errors, saying that org.jdesktop... isn't found.
Okay so I've already searched stackoverflow and the web for this. So I ended up getting the swing-layout-1.0.4.jar from the libraries in netbeans.
I'm kind of new at compiling from command line, but I put them all in the same folder, and while I was in that directory.
I did
javac StartFrame.java -cp swing-layout-1.0.4.jar
and I got the error that NoClassDefFoundException: MenuFrame even though it is in the same folder. So then I tried
javac StartFrame.java MenuFrame.java -cp swing-layout-1.0.4.jar
and it compiled fine with no errors. So then It created 6 files StartFrame.class StartFrame$1.class StartFrame$2.class StartFrame$3.class StartFrame$4.class MenuFrame.class
I tried running it with
java -cp swing-layout-1.0.4.jar StartFrame
and it had a NoClassDefFoundException: StartFrame. I searched the web for fixes for this and stack overflow and found similar (not exact though) problems like this, but none of those fixed it.
The file dist/README.TXT will tell you how to proceed. Type ant -p at the command line to see that available commands: ant run is usually good.
Addendum:
The machine doesn't have ant installed
That would be unusual, so you should certainly verify it. You may need to add the current directory to the path, e.g.
java -cp .:swing-layout-1.0.4.jar StartFrame

T24 cannot find a class after install, need more configuration?

I am quite new to TEMENOS t24, as this is my first install of the application. Sorry if this is too basic, but I am rather lost here, so please bear with me and help me out if you can:
After completing the install of Model Bank on my test server, I get the following error after trying to run the tRun EX command from console:
Cannot find 'EX' (class : 'com.temenos.t24.EX_cl')
The TAFJ installer gave no error whatsoever, and I double-checked all the directories and files copied from TAFJ_HOME to my T24_HOME, and they appear to be the same, same file and folders size and same number of files and folders as well, so it doesn't seem to be anything "missing" from my installation.
Could it be a configuration issue? Is there another path or tafj.properties entry that I could be missing? btw, it's a Windows install that I am trying here, if that helps.
Thanks in advance for any help you can provide in order for me to finish this install.
EX is a T24 program which is the entry point to login to T24.
tShow EX - This commnad should show you the java class path for this Program.
If not, Please make sure if you have the proper classpath setup in tafj.properties
temn.tafj.directory.precompile=/../../T24/T24lib
I fixed this issue by copying complete t24lib jars , issue was coming because earlier few jars were not copied properly and size was showing 0 kb.

Eclipse Build Error "A class file was not written. The project may be inconsistent, if so try refreshing this project and building it"

I have been struggling with a very weird issue that has suddenly popped up on the latest version of Eclipse Classic (4.2.2).
Everytime I try creating or refactoring a class or subclass in any of my projects (all Java) in my Eclipse workspace I get an error at the very top of my class that says
A class file was not written. The project may be inconsistent, if so try refreshing this project and building it
Again, this happens when I create new classes. And even when I rename current classes, then undo the renaming, its totally fine, but changing a single character in the name causes this error to happen for that specific class.
I have Auto Build on, and I tried multiple times to clean and refresh every project as well as restart Eclipse entirely.
I have literally no idea how to even start figuring out how to fix this. The solutions i've found through search didn't help, so i'm hoping I might find any clues here.
I had the same problem and here's how I solved it in the end:
It turned out that the disc space on the drive where workspace resides was full.
Silly mistake but worth checking.
In my case, this was caused by the fact that the build output directories were owned by a different user, and Eclipse could not write into them.
I had the same issues, the following worked for me:
Right click eclipse then running "as an Administrator"
Click Project > Clean.
Clean your workspace by starting eclipse from the command line with the -clean argument :
eclipse -clean
See also How to run eclipse in clean mode? and what happens if we do so?
I solved this problem by running Eclipse as root.
I had the same issue on Mac OS X. I had a maven project.
Try running the following command on Terminal. This looks like an access issue.
sudo mvn clean
Provide password for admin user.
Then open Eclipse and refresh your project.
We are using Eclipse here too and have to handle a workspace with more than 200 plug-ins. Every now and then people have similar problems with their workspace and inconsistencies reported in a weird way by Eclipse.
What people here usually do is (next step only in case previous step didn't help):
- trying to ContextMenu->Team->Clean/Refresh the whole workspace
- creating a new workspace and check out all necessary files from the repository
- reinstalling Eclipse to a new directory
From my experience after using the Eclipse IDE on a daily basis for many years, it doesn't make very much sense to waste too much time with these issues, unless they aren't solved by one of the steps above. It takes too much time to struggle with these things, while starting from scratch is done in an hour or less (and usually fixes the issue).
If your Eclipse still behaves strangely it might make sense to go through your installed plug-ins. Not all external plug-ins follow the Eclipse guidelines and can seriously harm the performance and operational consistency of your Eclipse installation (E.g. Sonar Plug-in, Toad Plug-in, ...)
In my case this kind of error caused due to disk space got full and it got resolved by just freeing disk space where eclipse have been installed.
That is c/d/e drivers.
I come up with the same error, and in my case, this is because the permission of the project/bin directory is not recursively 775
I fixed it by:
Remove the project/bin directory: sudo rm -rf project/bin
Switch to Eclipse, rebuild the project: Project->Clean...
Then no errors.
Try to launch Eclipse as Administrator.
In my case such error was caused by a question mark in a quoted method name (I use geb+spock combination for automated testing).
So this method name will throw an error "Do you want something?"()
And this will not "Do you want something"()
It may not be the best response but to fix it, I've just delete the error marker.
Had the same issue. but cleaning the project and restart eclipse didn't help and disk space was not the issue. Solved the issue by copy the code to notepad(just to not lose it) and then delete the class, recreate it and paste the code back in again.
I solved it changed the owner of the project files. I changed from root(old owner) to user my current(user that i use with eclipse).
Just changed and saved java file to recompile the class. Then error disappeared.
I was try run
Project->Clean...
And Rebuild. My problem was resolved
For linux (Debia) and working on Spring boot project (maven):
$ sudo mvn clean
Then open Eclipse and File -> Refresh.
I had same issue, it is something similar but this post didn't help in my case. I have many inner classes which is causing the compiler to create class names with all inner class names together that is creating class name more than 255 character file limit on NTFS! read it in some other blog. I thought it will be helpful to post here.
Ex : classA$InnerClassB$......InncerClassZ.class in target folder it won't generate the class if it exceeds this limit. Try renaming your inner class name shortened. In my case i have to add InnerclassZ as its exceeding its not generating class and Eclipse complaining.
A class file was not written. The project may be inconsistent, if so try refreshing....
I shortened InnerClassZ to IClassZ fixed the issue.
I had the same issue and it got fixed by running eclipse in administrator mode
Eclipse Shortcut-->Right click-->More-->Run as Administrator
I've been throught that error once when I used wsdl2java to extract java classes from a wsdl, it turns out that all classes were created in the same "class", causing end classes with long names (error - File name too long). When I organized and rename some classes the error disappeared.
I had this issue. I did the following, it resolved.
Open Eclipse in Administrator mode; Right click on eclipse.exe "Run as administrator"
Clean all projects.
#Denny's answer put me on the right track, though in my case it was the target directory. I deleted it for some reason and something automatically recreated with owner root. Changing the directory owner was not enough as it contained files that were also owned by root. So make sure to really remove the complete content of the directory and to change the owner.
In my case current user didn't have access to this project dir
Before giving a try to the above solutions. Just cleaned the project and it worked.

Running a mapreduce jar on Hadoop cluster

I'm trying to run the map reduce implementation of quadratic sieve algorithm on Hadoop. For this purpose I'm using karmasphere Hadoop community plugin with Netbeans. The program works fine using the plugin. But I'm unable to run it on actual cluster.
I'm running this command
bin/hadoop jar MRIF.jar 689
Where MRIF.jar is the jar file made by building the netbeans project and 689 is number to be factored. The input and output directories are hard coded in program itself. When running on actual cluster, it appears that the inside java classes are not being processed as reduce completes to 100% before map being at 0% itself. And input and output files are created with no content.
But this works fine when running using Karmasphere plugin.
Try running it as bin/hadoop -jar MRIF.jar 689. The -jar forces it to run local and displays information to the console as well as logs to that machine. You can also check the Hadoop logs to see if they have any indicators of why it's not happening correctly.
When using -jar you can use System.out.println(...); to display information on the console, further helping to debug.
You can also use Hadoop Counters (link is random blog post I found) to assist in troubleshooting when running (psuedo-)distributed.
I admit this post isn't a 'solution' to the problem; Without more/further information about what is happening and where, there is a wide range of things that could be going on. If it is, as you mention, not processing the 'inside java classes' then it would likely be your implementation, of which we can't see to make suggestions, ect.
More data about the issue, such as logs, errors or output will likely assist in getting more solution-y responses instead of debugging tips. :)
EDIT: Thanks for the link to the files. I think your call is missing a component.
I looked in the run.sh and think this might get it to work for you:
bin/hadoop jar mrif.jar com.javiertordable.mrif.MapReduceQuadraticSieve 689

GWT uploading a file to a unix path

I'm kinda puzzled how does a unix path looks like. I have followed an example to write a simple fileuploader using GWT. But the guide was written with Windows in mind. Say if I have C drive. In windows I would told the program to save the files to C:\save_here\
But in unix, I'm using ubuntu, there are no C drives or other drives with a single letter representation. So I wonder what do I write instead? I'm getting error 500 all the time now. And I can't figure out how the path should be.
The guide I've been following is found here
EDIT
It was not some problem duo to the path. Still need help though with fixing this problem. I basically followed the steps in the url I posted on this question.
unix paths start at a common root , denoted / and separates directories with a /
e.g. /home/starcom might be your home directory. So create a new directory, mkdir /home/starcom/uploaded and use that as the path. Or for testing you could perhaps just use /tmp
You can get more info here
When you get a 500 return code, that means the server encountered an error. This means that you should see an error message from the server somewhere. If you're running from Eclipse, you'll see the error on the Console tab. If you're running Tomcat, look for those logs.
You want to find the error message, since it'll probably explain what went wrong.