Git Product home page Git Product logo

sublimejavacompiler's Introduction

I am not have a time to maintaining this project anymore. Feel free to fork and continue - or just create some pull-request, I am still here.

Sublime Text Plugin: Javac

Basic

This plugin adds the following commands to sublime Command Palette:

JavaC: Compile Current File
JavaC: Compile & Run Current File
JavaC: Compile Current Project
JavaC: Compile & Run Current Project
JavaC: Generate Jar Package For Project
JavaC: Generate & Run Jar Package For Project
JavaC: Clear Project

Installation

Move to you "Sublime Text" packages folder and clone this repository to it:

git clone [email protected]:psychowico/SublimeJavaCompiler.git

Configuration

When you trying compile simple java file, you should just use "JavaC: Compile Current File" or "JavaC: Compile & Run Current File" options. When you want compile full project, more complex, with namespaces, libraries etc. you need add to project configuration file. When you run "JavaC: Compile Current Project" command JavaC offer you to generate project configuration file. It will be settings.sublime-javac.

{
    "project_name"      : "HelloWorld",
    "output_dir"        : "output",
    "sources_dir"       : "src",
    "encoding"          : "utf-8",
    "resources"         : [],
    "libs"              : [],
    "entry_file"        : "Test/HelloWorld.java",
    "entry_point"       : "Test.HelloWorld"
}

Options meaning:

  • project_name - simply project name, use as output name for generating jar file
  • output_dir - where jar and classes file should be generated
  • sources_dir - where *.java sources of you file are stored
  • encoding - compilation encoding, utf-8 default
  • resources - list of resources files, they will be copied to you output classes directory and included in jar package (you can use asterix for file groups)
  • libs - java jar external packages should be linked to you project
  • entry_file - entry file where you have class with "Main" program function
  • entry_point - class with "Main" program function

All pathes are relative to you project main directory (where settings.sublime-javac file is stored).

Keyboard

You can add keyboard shortcuts by clicking in you "Preferences/Key Bindings - User" and add additional lines:

{ "keys": ["f5"], "command": "javac_compile_and_run_project" },
{ "keys": ["f6"], "command": "javac_compile_project" },
{ "keys": ["shift+f5"], "command": "javac_compile_and_run_file" },
{ "keys": ["shift+f6"], "command": "javac_compile_file" },
{ "keys": ["ctrl+shift+f7"], "command": "javac_clear_project" }

Settings

You can change settings about Java path or hide output-window option.

  • Open your SublimeJavaCompiler User Settings Preferences file Preferences -> Package Settings -> Sublime Java Compiler -> Settings - User
  • Add or update items.

These are the basic settings you can change:

{
	"java_path" : "java",
	"javac_path": "javac",
	"jar_path"  : "jar",
	"javac_autohide": true,
	"hide_output_after_compilation": true
}

sublimejavacompiler's People

Contributors

iandmyhand avatar wiktor-obrebski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublimejavacompiler's Issues

Generate New Configuration not working

To start off I'm new to adding and using packages with Sublime Text. I have Sublime Text 2 and when I go to Compile and Run Current Project it gives me the option to Generate New Configuration or Cancel. When I select Generate New Configuration nothing happens. I could make the file myself but I don't know where to put it so the compiler can find it. Suggestions?

"Generate Jar.." in complex Java project with multiple libs fails to compile in ST2

Environment: Windows 7 64 bit, Sublime Text 2.0.2 Build 2221

Steps to recreate:

Java project has the following configuration in the javac file, and the java project has multiple resources and jars.


{
    "project_name"      : "test",
    "output_dir"        : "bin",
    "sources_dir"       : "src",
    "resources"         : ["resources/*"],
    "libs"              : ["lib/myUtils.jar","lib/open-csv.jar","lib/config.jar","lib/jdbc4.jar"],
    "entry_file"        : "com/exa/bigdata/Driver.java",
    "entry_point"       : "com.exa.bigdata.Driver"
}

Run the "Generate jars... " command in ST2
Use: Ctrl + SHIFT+P to access Command Menu, Type in > "Generate jars".

The following results happens:

-There is no

------------Compiling project------------ 

in the sublime console.
-Resources all copy into my Output dir fine.
-Libs do not get copied so well. Only the first one in the list gets copied to the output_dir/dist/lib .
-There is no output in Sublime console with any information relating to the compilation, it is just blank.

Help compiling project

Hi

I have this structure..
src
src / file1.java
src / file2.java

File settings.sublime-javac
{
"project_name": "Example",
"output_dir" : "bin",
"sources_dir" : "src",
"resources" : [ "src/*" ],
"libs" : [],
"encoding" : "utf-8",
"entry_file" : "file1.java",
"entry_point" : "file1"
}

And file1.java refers to file2.java.

When I try to compile the project, I receive this message...
------------Compiling project------------
file1.java:48: error: cannot find symbol
private file2 engine = null;
symbol: class file2
location: class file1
...

What am i doing wrong?

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.