Cannot open Selenium Jar file from CMD. Path or ClassPath issue? - path

I'm trying to launch:
java -jar selenium-server-standalone-2.14.0.jar -role hub
from my Command Prompt but output was as below:
C:\Program Files (x86)>java -jar selenium-server-standalone-2.14.0.jar -role hub
Unable to access jarfile selenium-server-standalone-2.14.0.jar
C:\Program Files (x86) is where the jar file is located.
I've put C:\Program Files (x86) in my PATH and CLASSPATH and it still won't work.

Your filename must be wrong. Check whether you have a file named -selenium-server-standalone-2.14.0.jar. Chances are you won't be. :)

I encountered the same issue.
The solution is that the naming convention matters.
if you have a selenium server standalone.jar file, you can rename it first
to make it look simple(example abc.jar).
1) If the jar file in your system is encountered with the .jar extension,
then after renaming, give the .jar extension.(eg abc.jar)
2) If the jar file in your system is not having the .jar extension,
then after renaming, dont provide the .jar extension(eg abc)
3)Start the hub now:
java -jar abc.jar -role hub
Regards,
Nikhil Kanojia

Unable to access the jarfile is considered as Common Error.
This error can occur when starting up either a hub or node. This means Java cannot find the selenium-server jar file. Either run the command from the directory where the selenium-server-XXXX.jar file is stored, or specify an explicit path to the jar.
Go for details here

1.goto root mode
2. install $apt install mlocate
3. locate your jar file
4. check the correct jar file name and again try to open it with specific command
5 java -jar ./selenium-server-standalone-2.14.0.jar

I had the same issue with ubuntu. Try following steps..
Go to the directory where the jar file located.
Then execute the .jar file in the directory using,
java -jar ./selenium-server-standalone-2.14.0.jar

Go to desired location in command prompt and enter the below command.
java -jar ./selenium-server-standalone-3.141.59.jar
That means if you save the .jar file in "C:\Eclipse\jar" location then the command should be:
C:\Eclipse\jar>java -jar ./selenium-server-standalone-3.141.59.jar

Related

How to run 2 .exe files using registry keys

The idea here is to make 2 .exe files run when I open only 1 of them.
I have 2 files:
F:\Gry\Riot Games\League of Legends\LeagueClient.exe
C:\Program Files (x86)\Overwolf\OverwolfLauncher.exe
When I launch LeagueClient.exe I'd like OverwolfLauncher.exe to run alongside it. Is there a way to do it?
I don't think you'll be able to modify the LeagueClient without running with any issues with the anticheat, I believe creating a bat file would be what you want.
#ECHO off
start F:\Gry\Riot Games\League of Legends\LeagueClient.exe
start C:\Program Files (x86)\Overwolf\OverwolfLauncher.exe

How to set log4j.property to .jar location

I'm Setting up Log4j2 in a Spring-boot application. I now want to create a /log directory exactly where the .jar file is located.
This is needed as we start the java application from a startup script and the configuration should work on both windows and unix developer machines as well as a server.
I already tried with:
<RollingFile name="FileAppender" fileName="./logs/mylog.log"
filePattern="logs/mylog-%d{yyyy-MM-dd}-%i.log">
which just creates a log folder at the directory where the jar gets started.
then I read i should use .\log/mylog.log as .\ points to the directory of the jar file.
But then it just creates a folder called .\log.
I also tried with configuration with jvm arguments and calling them at the log4j2.xml with: ${logFile}. Now a directory gets created called '${logFile}.
The only ${} command working is the directory of the log4j configuration file. But as this is inside the jar it just gets me a pretty useless folder structure
Thanks in Advance
EDIT: In the End what I did was setting up two configuration files, log4j2.xml and log4j2-prod.xml
The log4j2.xml took the system property as Vikas Sachdeva mentioned, while the prod.xml got the location hard coded.
Not really the solution I was looking for but made it work.
One solution is to pass log directory location through system properties.
Configuration file will look like -
<RollingFile name="FileAppender" fileName="${sys:basePath}/mylog.log"
filePattern="${sys:basePath}/mylog-%d{yyyy-MM-dd}-%i.log">
Now, pass VM argument basePath with absolute path of directory containing JAR file -
java -jar myapp.jar -DbasePath=/home/ubuntu/app

Java windows command

I am trying to compile some java code on Windows 7 pc, I have installed java JDK and I am trying to use the javac command in cmd but I get output saying that
'javac' is not recognized as an internal or external command,
operable program or batch file.
What do I have to do to enable compiler in cmd or is it possible to do in Windows?
1)Go to properties by right click on icon Computer , then navigate to Advanced System Settings.
2)Click Environment Variables.
3)Click on New , set Variable name as path and Variable path as the path of java jdk installation directory which could be something like this -
C:\Program Files\Java\jdk1.6.0_23\bin;
where C:** is the drive where JDK is installed and **Program Files\java is the directory where it resides.
look out for semi-colon(;) at the last.
4)Click ok
5)Restart cmd and run javac , it should work now.
Look for Screenshots here for more help.
Regards
Anshul
you have to set a new system variable for your JAVA_HOME in windows.
See here for further information.
Add the path to bin folder of JDK in your PATH variable. For instructions to set PATH variable follow this tutorial.
Your java directory is not on the path. Here are some helpful screenshots to show how to set it up:
http://vietpad.sourceforge.net/javaonwindows.html

Grails installation

I am trying to install grails in my windows 7, I have installed JDK 1.7.0 and downloaded grails from its site and extracted in path "C:\grails", i have jdk in "C:\Program Files\Java\jdk1.7.0". I have set environment variable JAVA_HOME = "C:\Program Files\Java\jdk1.7.0\bin" and GRAILS_HOME = "C:\grails" and added "%GRAILS_HOME%\bin" and JAVA_HOME to path from advanced settings. But when i try to run "grails -v" or "grails help" i get the error "The system cannot find the path specified.". I even changed my directory to "C:\grails" and ran "grails -v" but it is still giving me the same error.
I dont know what is wrong with it, please help me installing this thing.
Thanks
JAVA_HOME = "C:\Program Files\Java\jdk1.7.0\bin" mustn't include 'bin'
You'll want to verify that Java is working correctly first by entering "java -version" at the command line.
When you say you extracted the zip into "C:\grails" does that directory now just have a single sub directory (i.e. "grails-2.5.0" or whatever version you downloaded), or does it contain a bunch of sub directories (bin, conf, dist, doc. etc)?
If the answer is the former, your GRAILS_HOME should point to "C:\grails\grails-2.5.0" instead of just C:\grails\

how to compile java files classnotfoundexception

I am having a java project having the directory structure as
java->applet and a few .java files
the applet folder further contains two folders and some .java files
I need to develop a jar file out of this project
I did so by writing the command line
jar cvfm myfile.jar *.java
(obviously by moving into corresponding directory)
when I checked by extracting the file(it was zipped as a Nokia application installer file)
it showed me only the classes in the applet folder not the folders in it
moreover i needed to use this jar file in a jquery plugin where i had written
var dasherApplet = $('applet');
dasherApplet.attr({
'height':'100%',
'width':'100%',
'archive':farfalla_path+'plugins/dasher/jardasher.jar',
'code':'JDasherApplet.java'
});
but it showed me the class not found exception
for this I checked the previous versions of the java applet; there the java files were replaced by .class files so i tried compiling a java file into .class by using the command line
C:/>javac filename.java
still all in vain this time it showed me
"cannot find symbol" error
what was interesting was that the errors generated were imitating the java files present in the same folder. I navigated to the directory where the file was stored still the same error
when i tried to simply run it by using
java filename.java
error was main class not found:JApplet.java
Please help me develop this applet
Firstly you need to compile all the jar files before running.
Secondly , you CANNOT run Applets using java filename.java .
As this link explains http://download.oracle.com/javase/tutorial/deployment/jar/build.html ,
jar cvf TicTacToe.jar TicTacToe.class audio images
Here audio and images are folders , so that is how you add folders to jar.
Also .jar files are not Nokia Application Installer files . Nokia simply associates them for installing apps (that is J2ME)

Resources