"jar cvf ui.jar -C bin ." doesn't seem to work for me - eclipse

While setting up the HSQLDB plugin for eclipse, I've run into issues creating a ui.jar file (via the console command) in my hsqldb.ui directory. When running the command
jar cvf ui.jar -C bin .
I constantly get a message saying "jar" is not recognized as an internal command. The JRE and JDK files are set up properly, at least I assume (as I've been running eclipse for 2 months now). So, I'm at a loss for what to do.
Any bump in the right direction will be appreciated.

The jar executable should be located in the bin directory under your java sdk installation.
You will need to add that bin directory to your system environment PATH variable if you want your shell or console window to find it.

Related

Eclipse can't see /usr/local folder on mac

I am developing a web application in Java on my mac.
The web application will run on tomcat.
I have installed tomcat in /usr/local/apache-tomcat.
When I try to set the tomcat runtime in Server->Runtime Environments, I am not able to see the folder /usr/local. how do I get eclipse to see the /usr/local/apache-tomcat directory?
I am able to see /usr/local when using the Go to Folder option in Finder.
I had similar problem with loading external jar files in /usr/local/ for Eclipse on Mac
The way i resolved this was to create a soft-link using ln -s to the folder in /usr/local to a visible folder and then loaded the jars.
ln -s source visible_location/link
Works for me.
I just got a similar problem, and the workaround i found is to copy/paste the path of your tomcat base directory, and it works fine:
Go to your tomcat base directory
pwd to get the path and copy it
Go to eclipse -> preferences -> servers -> runtime environments -> add button -> select apache tomcat version -> then next
At this step, instead of browsing, you can simply paste the copied path in the Tomcat installation directory field!
et voilĂ 
My guess is that you have your finder settings that hide hidden folders. It is possible to show them by following the instructions in this article.
The easiest way to do this is to type the following in your terminal:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
If you type out the full name of the installation folder instead of using the finder, does it work?
You can easily control hidden files writing this in bash_profile
alias hideOn='defaults write com.apple.finder AppleShowAllFiles TRUE'
alias hideOff='defaults write com.apple.finder AppleShowAllFiles FALSE'
alias kFinder='killAll Finder'
alias hOn='hideOn && kFinder'
alias hOff='hideOff && kFinder'
Then, reopen your terminal and write hOn. At root folder you will see hidden /usr. Just put it in your finder sidebar. Then write hOff and you will stop seeing the hidden files, but /usr will be always there at finder.

Configure Eclipse IDE to move cache data out of eclipse installation direction

I believe this is normal user's behavior:
After downloading the eclipse IDE distribution, such as eclipse-jee-mars-2-win32-x86_64.zip file, you unzip it to a folder, e.g. C:. The eclipse executable is at C:\eclipse\eclipse.exe. (Here I'll refer C:\eclipse directory as eclipse home directory.)
When running, eclipse will write some temp or customization file under eclipse home directory, so the eclipse home directory became dirty. I wonder if there is any parameter or configuration file setting so eclipse will write those cache/temp/customized data to somewhere else.
I'm not talking about '-clean' parameter. From the help file, I think I should try -configuration configURL. However I don't know the format of the configuration file.
Here is the best I've got so far after some trial and errors:
Take C:\eclipse as my eclipse home directory, which is extracted from eclipse distribution zip file. My goal is to keep this home directory clean.
I created the following directories:
C:\eclipse-work.ws
C:\eclipse-work.home\user
C:\eclipse-work.home\configuration
Here is the command line I used to start eclipse, of course it's part of a script:
C:\eclipse\eclipse.exe -data C:\eclipse-work.ws -user C:\eclipse-work.home\user -configuration C:\eclipse-work.home\configuration
The trick is I need to make configuration directory to be a two level directory as eclipse will generate other cache or data under C:\eclipse-work.home dir.
This is the best I can get so far. All cache data, as well as plug-ins I installed, will be in the C:\eclipse-work.home directory. There is only one file generated under original eclipse home directory, that is a profile gz file under
p2\org.eclipse.equinox.p2.engine\profileRegistry\epp.package.jee.profile
directory. And this file won't be changed once it's created.
I'm using a ram disk. Using above approach I can setup the eclipse IDE in the ram disk image file. Now eclipse starts much faster.
For that -user directory, so far I didn't observe any file generated under it. Not sure if it can be omitted.

How to execute Testng project without main method from command line

I have a TestNG project where I use testng.xml file to execute.
How to take a jar of my project and execute it on another machine.
I know how to execute it on the same machine by giving path of bin & lib folders i.e
cd C:\Workspace\projectname java -cp
C:\Workspace\projectname\lib*;C:\Workspace\projectname\bin
org.testng.TestNG testng.xml.
But if i want to do on another machine how to do this?
You can create a bash file which points to your testng.xml file.
Use this:
Bash file is running fine in windows for testng but it is not working in linux/mac
Steps:-
1. Create a notepad file
2. Copy -> java -cp ./src/lib/*:./bin org.testng.TestNG testng.xml(use ; instead of : if you are using windows) (./src/lib/* -> All your jars files must present in this location, ./bin -> all your class files must be present here)
3. save the file.
4. Rename the file as something.bat
5. Double click on file if you are using windows or use **bash filename** if using linux or mac
Note: - Java, require browsers must be present in other computer and it's a prerequisite which is nothing to do with your automation script run. they must be pre-installed

Installing Maven 3.1.1 on Maverick and working with eclipse-Kepler TLM terminal plugin

I recently installed OS X 10.9 Mavericks. As it does not come with Maven pre installed, I installed Maven 3.1.1 manually. I exported maven and set its path in .bash_profile. It is accessible from command line. But it is not accessible from within eclipse TLM terminal plugin or Wicked Shell plugin.
One workaround I got is, I added same export statement in .bashrc and it is accessible now from within eclipse aforementioned terminal plugins. Is there any better solution for it? Can anybody explain how many .bash* files are there in mac and when each one is initialised ?
In order to have eclipse pick up the new addition to your PATH, you need to edit /etc/launchd.conf to set the environment variable explicitly. Environment variable substitutions such as $PATH will not work. To correct do an echo $PATH in terminal and copy what it returns. Then, add this line to the launchd.conf file and restart your machine.
setenv PATH <your echo $PATH results here>
After, all should return to normal in eclipse. Hope this helps!

Unable to start Eclipse -- can't open \Java\jre6\lib\i386\jvm.cfg

could not open C:\Program Files\Java\jre6\lib\i386\jvm.cfg
is the error coming when i am trying to start eclipse ide.
my C:\Program Files has
jdk1.6.0_14
jdk1.6.0_17
jre6
folders.
path is set to
PATH: C:\Program Files\Java\jdk1.6.0_17\bin
what is the problem
i have seen this link but it is not solving my problem
can't find JRE in the JDK
I had similar problem on a Windows machine. I had moved my Java directory from inside "Program Files" (the space in the directory name was giving me trouble) over to c:\
I set all my PATH variables to the new location, restarted the machine and thought that would be enough. Nope
java -- version
Error: could not open `C:\Program Files\Java\jre1.8.0_66\lib\i386\jvm.cfg
This solution came from the good folks over at coderanch
Start regedit (just type "regedit" into the Run program) and work your way down to HKEY_LOCAL_MACHINE > SOFTWARE > JavaSoft
There you will find several different java directories
Java Development Kit
Java Plug-in
Java Runtime Environment
Java Update
Java Web Start
In each directory you'll find different directories for the different version of java (esp. Java Web Start). Open each and every one and you'll see that your old path is still listed. Double click the Name (left column) of the listing and manually type in the new path.
Open a new terminal and type in Java - version and you should be fine.
This problem can show up if you initially install Java in the default location (C:\Program Files) and then later re-install into another location.
The default installation copies java.exe, javaw.exe and javaws.exe to C:\Windows\System32. If you are in this situation and delete these files it will likely solve your issue.
(Thanks to Jay: http://jaykhimani.blogspot.com/2012/09/error-could-not-open-cprogram.html)
Problem: Eclipse Neon error: "C:\Program Files\Java\jre1.8.0xx.xx\jvm.cfg"
Solution Win7 Pro: System Properties > Enviorment Variables > System Variables > Path > Edit > #make sure the current JAVA directory appears first in the path if more than 1 JAVA directory exist.
In the path that follows, I moved "C:\ProgramData\Oracle\Java\javapath" behind the current directory "C:\Program Files\Java\jdk\bin;C:\Program Files\Java\jre\bin" > save
Path
C:\Program Files\Java\jdk\bin;C:\Program Files\Java\jre\bin;C:\apache-maven-3.5.0\bin;C:\ProgramData\Oracle\Java\javapath
I also had this problem and was having trouble finding a solution, but now I did!
If you uninstall your current running jre version and then install higher one you are good to go.
I was using jre1.6 when I had this problem but after installing 1.7 it was solved!
I recently got the same problem on my Windows 7. The issue was that two different paths were specified for Java in the path environment variable. This can be checked as follows.
On the command prompt, run the following command:
> where java
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe <br/>
C:\Program Files\Java\jdk1.8.0_192\bin\java.exe
The first one was the cause of the issue and removed it from the path.
Eclipse is working now without re-installation.
Note: The environment vars have been as follows always:
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_192
JRE_HOME=C:\ProgramFiles\Java\jdk1.8.0_192\jre
The problem is that your eclipse cant find jre.Just copy and paste your jre folder into eclipse folder and then start eclipse.Delete environment variable.
What worked for me was to go back to the Java webpage and download the Java jre instead of the jdk, since that is what the stupid computer is now looking for. Then open the C: Program Files>Java and make sure you see jre7 instead of jdk.
RS
Have a simpler solution:
Check your PATH. Most likely it is referring to incorrect java.exe. This started happening to me when I installed OS patch. In process of checkpoint etc, PATH got modified. Once I corrected it (using Environment Variables...), it worked immediately.
Try putting below line in your eclipse/STS -STS.ini file
-vm
C:\Program Files\Java\jdk1.8.0_121(your JDK version)\bin\javaw.exe
Put it at the top of the file.
Most probably it will work.
Sometimes putting javaw.exe in eclipse folder also work (where eclipse.exe is there)
This is an old post, but what solved my solution was editing the `eclispe.ini' file to include the correct path to the JDK.
Building off of what Lars answered, I did reinstall Java, so that may have been the source of the issue. Reglardless, this is the solution that worked for me. I did not have to delete any files from C:\windows\system32, however. I merely told eclipse to look in the new Java installation directory.
These docs indicated I needed to specify the path to the VM:
-vm
C:\Java\jdk1.7.0_25\bin\javaw.exe
This problem mainly occurs when we install new jre or jre gets updated automatically since jdk version and jre version are different and path variable i.e. JAVA_HOME contains jdk path with version included in it . Eclipse might be using that to generate the jre path name for the said file.
I did workaround i.e. changed name of jre folder to the older version e.g.
jre1.8.0_191 is after installing update and
jre1.8.0_60 was before update.
I renamed jre1.8.0_191 with jre1.8.0_60 to solve the issue
I had faced similar problem. Environment variable path problem
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_192
Set the Environment variable after going
Control Panel\All Control Panel Items\System and select Advanced System Settings then set Environment Variables
In System Variables add a new variable JAVA_HOME and variable value = C:\Program Files\Java\jdk1.8.0_192, the path of the jdk file in your system.
and %JAVA_HOME%\bin in the path of the system variables.
Hopefully the problem will solve.
After doing this It works fine for me.