PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, June 26, 2022

[FIXED] How do you compile a java program from the command line while using selenium in the source code?

 June 26, 2022     compiler-errors, java, selenium     No comments   

Issue

I am working on a final project for my Computer Science course. I built an program using the Selenium library to automate the process of creating a github repo and linking it to a local folder. I am only able to run the program inside of VS Code using their "Run" feature. I want to be able to run this from the Command Line in Windows, but I am not able to compile it since Java doesn't recognize Selenium object types like WebDriver and WebElement. How would I compile it using this outside library?


Solution

It is strongly recommended to use Maven for java projects. It can fetch all the needed dependencies if you have added the maven dependency to the pom.xml file.

Otherwise download the Selenium jar file and use the following command to compile your code.

javac -cp .:jarfile1.jar:jarfile2.jar <MainClass>.java

and run the following to execute

java MainClass



Answered By - shmsi
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing