From 9d2951330c9cc41378a3c04e77495d0b29243cb9 Mon Sep 17 00:00:00 2001 From: Celia18305 <32253925+Celia18305@users.noreply.github.com> Date: Thu, 19 Apr 2018 17:28:42 +0800 Subject: [PATCH] resolve confilicts of #469 (#475) --- en-us/sc/quickstart/getting-started-java.md | 25 ++++++++++++++++----- en-us/toc.yml | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/en-us/sc/quickstart/getting-started-java.md b/en-us/sc/quickstart/getting-started-java.md index 8487c5538c..2b7086acca 100644 --- a/en-us/sc/quickstart/getting-started-java.md +++ b/en-us/sc/quickstart/getting-started-java.md @@ -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. @@ -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: @@ -145,6 +145,18 @@ 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: @@ -152,7 +164,7 @@ Then using neoj, run cmd.exe and execute: **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` @@ -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. diff --git a/en-us/toc.yml b/en-us/toc.yml index a40c765b4d..4d3f473424 100644 --- a/en-us/toc.yml +++ b/en-us/toc.yml @@ -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