Skip to content

Commit

Permalink
resolve confilicts of neo-project#469 (neo-project#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
Celia18305 authored Apr 19, 2018
1 parent 4b93f4f commit 9d29513
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
25 changes: 20 additions & 5 deletions en-us/sc/quickstart/getting-started-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
typora-root-url: ..\..
---

### How to use Java to write a NEO smart contract
# How to use Java to write a NEO smart contract

Smart contracts are written in high-level languages such as Java, C#, Python, Kotlin (and more...) and compiled into AVM (Neo's Virtual Machine bytecode) so that they can run on the Neo network.

Expand Down Expand Up @@ -125,7 +125,7 @@ After the above installation is complete you can create a Java project (e.g. usi
You need to compile the .jar package of smart contract from the neo java devpack project ([neo-devpack-java](https://github.com/neo-project/neo-devpack-java)) and add it as an external library.


## Compile the Project
## Compile the Java Project

Everything is now ready to add the entry method that defines the smart contract:

Expand All @@ -145,14 +145,26 @@ public class HelloWorld extends SmartContract {

Build the project which will give you `HelloWorld.class` in your out folder.

Alternatively, you can build from the command line in Mac OS.

**Mac OS:**

`cd /path/to/HelloWorld/project`

`javac -cp /path/to/org.neo.smartcontract.framework.jar HelloWorld.java`

You should now have a HelloWorld.class in the same directory as HelloWorld.java

## Transform HelloWorld.class to HelloWorld.avm

**Windows:**

Then using neoj, run cmd.exe and execute:
> neoj.exe HelloWorld.class
**Linux:**

Copy the jar in the dotnet's folder. For example:
Copy the jar into the dotnet's folder. For example:

`sudo cp org.neo.smartcontract.framework.jar /usr/share/dotnet`

Expand All @@ -166,9 +178,12 @@ Copy the jar to the neo-compiler's neoj folder. For example:

`sudo cp org.neo.smartcontract.framework.jar /path/to/neo-compiler/neoj`

and then from the neoj folder call
Also copy HelloWorld.class to the neoj folder. For example:
`sudo cp HelloWorld.class /path/to/neo-compiler/neoj`

> dotnet run org.neo.smartcontract.framework.jar
Then from the neoj folder call

> dotnet run HelloWorld.class

If successful, it will create HelloWorld.avm which you can now use as smart contract bytecode.
Expand Down
2 changes: 1 addition & 1 deletion en-us/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
href: sc/quickstart/getting-started-csharp-ubuntu.md
- name: Using Java
href: sc/quickstart/getting-started-java.md
- name: 使用 Python
- name: Using Python
href: sc/quickstart/getting-started-python.md
- name: Limitations
href: sc/quickstart/limitation.md
Expand Down

0 comments on commit 9d29513

Please sign in to comment.