Giter Club home page Giter Club logo

jhome's Introduction

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn PDD status Maven Central Javadoc codecov Hits-of-Code License

In your Java application you may want to run another Java application. In order to do this, you need to know where is the bin/java executable. It's in the JAVA_HOME (environment variable), which is not always set. Instead of looking for this place manually, just use this small one-class library.

First, you add this to your pom.xml:

<dependency>
  <groupId>com.yegor256</groupId>
  <artifactId>jhome</artifactId>
  <version>0.0.5</version>
</dependency>

Then, you use it like this:

import com.yegor256.jhome;
Path p = new Jhome().path("bin/java");

The result is the location of bin/java inside JAVA_HOME. Also, you can use java() and javac() methods in order to get the full path to java and javac executables respectively:

import com.yegor256.jhome;
Path java = new Jhome().java();
Path javac = new Jhome().javac();

How to Contribute

Fork repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full Maven build:

$ mvn clean install -Pqulice

You will need Maven 3.3+ and Java 8+.

jhome's People

Contributors

volodya-lombrozo avatar yegor256 avatar renovate[bot] avatar rultor avatar

Stargazers

PDD GitHub Chatbot avatar  avatar Max Trunnikov avatar  avatar Rui Neto avatar

Watchers

 avatar  avatar  avatar

jhome's Issues

Check if `javac` is installed

Currently we just throw exception if javac is not installed. It would we nice to have other option to check that javac is installed, for example by using method boolean hasJavac() or similar. Otherwise we have the only option to check presence of javac by catching an exception, which is an anti-pattern in fact.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codecov.yml
  • actions/checkout v4
  • actions/setup-java v4
  • actions/cache v4
  • codecov/codecov-action v4.0.0-beta.3
  • ubuntu 22.04
.github/workflows/mvn.yml
  • actions/checkout v4
  • actions/setup-java v4
  • actions/cache v4
.github/workflows/pdd.yml
  • actions/checkout v4
  • ubuntu 22.04
.github/workflows/up.yml
  • actions/checkout v4
  • peter-evans/create-pull-request v6
  • ubuntu 22.04
.github/workflows/xcop.yml
  • actions/checkout v4
  • ubuntu 22.04
maven
pom.xml
  • com.jcabi:parent 0.67.0
  • com.yegor256:jaxec 0.3.1
  • com.github.volodya-lombrozo:jtcop-maven-plugin 1.2.4
  • com.qulice:qulice-maven-plugin 0.22.1

  • Check this box to trigger a request for Renovate to run again on this repository

Jhome.java:82-85: The javac binary might not be available...

The puzzle 5-ee2a7bdc from #5 has to be resolved:

* @todo #5 The javac binary might not be available in JRE.
* We should check if we are running in JDK or JRE and somehow decide what to
* return in this case or even throw an exception in case of JRE. Maybe an
* {@code Optional<Path>} is also a solution here.

The puzzle was created by @volodya-lombrozo on 22-Nov-23.

role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

`java()` and `javac()`

What do you think if we add javac() and java() methods to Jhome? Then, instead of new Jhome().path("bin/javac") we will be able to write only new Jhome().javac().

`jtcop` support

Currently several tests violate test best practices:

        MatcherAssert.assertThat(
            new Jhome().path().toFile().exists(),
            Matchers.is(true)
        );

I suggest to add jtcop plugin to that library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.